想copy A2:J2的数据 到另外一个sheet,不是整个一行。另外因为是循环所以要求A:J 的row会变的。刚开始学VBA感觉和SAS实在太不一样了。
写的程序在下面那行红的就是有问题的,请帮我改改,谢谢!!!!!!
表达可能有问题,不清楚我的我在第一时间解释
Sub count()
Dim position As Integer
Dim start As Integer
start = 1
Dim ws1 As Worksheet: Set ws1 = ThisWorkbook.Sheets("Sheet1")
Dim ws2 As Worksheet: Set ws2 = ThisWorkbook.Sheets("Sheet3")
With ActiveSheet
Dim LastRowA As Long
LastRowj = .Cells(.Rows.count, "J").End(xlUp).Row
For jstart = 2 To LastRowj
For start = 2 To 303
position = InStr(1, UCase(Cells(jstart, 10).Value), .Cells(start, 17).Value)
If position > 0 Then ws1.Cells(jstart, Range("A:J")).Copy ws2.Cells(jstart, Range("A:J"))
Next start
Next jstart
End With
End Sub


雷达卡




京公网安备 11010802022788号







