在谈消表1中插李滚入哪侍余一个按钮,将下列代码复制到按钮的click(单击)事件中
Private Sub CommandButton1_Click()
n=sheet2.cells(65536,1).end(xlup).row+1
with sheet1
for i=6 to 10
if .cells(i,2)="" then exit for
sheet2.cells(n,1)=.cells(2,6)
sheet2.cells(n,2)=.cells(2,2)
sheet2.cells(n,3)=.cells(3,2)
sheet2.cells(n,4)=.cells(4,2)
for j=2 to 7
sheet2.cells(n, j+3)=.cells(i, j )
next
n=n+1
next
end with
End Sub
Sub jizhang()
Dim WS1 As Worksheet
Dim Rnum1, Rnum2
Set WS1 = Worksheets("sheet2"兆棚)
arr = Array(Range("F1"), Range("B1"), Range("B2"), Range("B3"))
Rnum2 = WS1.Range("B65536").End(xlUp).Row + 1
Rnum1 = 5
Do Until 乱猜樱Cells(Rnum1, 2) = ""
brr = Range(Cells(Rnum1, 2), Cells(Rnum1, 7))
WS1.Cells(Rnum2, 1).Resize(1, 4) = arr
WS1.Cells(Rnum2, 5).Resize(1, 6) = brr
Rnum1 = Rnum1 + 1
Rnum2 = Rnum2 哗丛+ 1
Loop
End Sub
将表格发过来试试。