我是VBA的新手......如果此行中的第一個單元格表示X,然後對滿足此條件的所有行執行此操作,我想從Sheet2複製一行到Sheet1標準。我在If條件中有錯誤...我不知道如何解決它。VBA將符合條件的行復制到另一張表
Sub LastRowInOneColumn()
'Find the last used row in a Column: column A in this example
Worksheets("Sheet2").Activate
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
MsgBox (LastRow)
For i = 1 To LastRow
If Worksheet.Cells(i, 1).Value = "X" Then
ActiveSheet.Row.Value.Copy _
Destination:=Hoja1
End If
Next i
End Sub
嘗試[自動填充](http://stackoverflow.com/questions/11631363/how-to-copy-a-line-in-excel-using-a-specific-word-and-pasting-to-another- excel -s) –
我會如果我知道編程...我一直在學習VBA ...兩天了:)這是一種方式,我可以理解什麼是代碼... – Anca