|
6#
楼主 |
发表于 2009-3-8 09:24:19
|
只看该作者
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i, j As Integer
j = 7
If Target = Worksheets("Sheet1").Cells(4, 4) Then
For i = 2 To 60
If Worksheets("Sheet2").Cells(i, 3).Value = Worksheets("Sheet1").Cells(4, 4) Then
Worksheets("Sheet1").Cells(j, 2).Value = Worksheets("Sheet2").Cells(i, 2)
Worksheets("Sheet1").Cells(j, 3).Value = Worksheets("Sheet2").Cells(i, 3)
Worksheets("Sheet1").Cells(j, 4).Value = Worksheets("Sheet2").Cells(i, 4)
Worksheets("Sheet1").Cells(j, 5).Value = Worksheets("Sheet2").Cells(i, 5)
Worksheets("Sheet1").Cells(j, 6).Value = Worksheets("Sheet2").Cells(i, 6)
Worksheets("Sheet1").Cells(4, 4) = ""
j = j + 1
End If
Exit For
Next
End If
End Sub
我自己改的,但是提示下标越界呢?请大家帮忙看一下。谢谢。 |
|