我正在尝试创建一个宏以在Sheet1中找到一个单词,复制该单词所在的整个行,然后将其从选定位置粘贴到Sheet2中,所以如果我从Sheet1复制Row4并将其粘贴到Sheet2中的Row2中列AQ。 如果无法做到这一点,则从Sheet1复制Row4,然后转到Sheet2,将3之后的所有行低1英寸,并将该行粘贴在3和4之间。
Private Sub Command_Click()
Dim intPasteRow As Integer
intPasteRow = 2
Sheets("tr_sold").Select
Columns("A:AV").Select
On Error Resume Next
Selection.Find(What:="m8", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
If Err.Number = 91 Then
MsgBox "ERROR: 'm8' could not be found."
End
End If
Dim intRow As Integer
intRow = ActiveCell.Row
Rows(intRow & ":" & intRow).Select
Selection.Copy
Sheets("sold_2").Select
Range().Select
ActiveSheet.Paste
End Sub