我想复制载有对另一张工作单具体价值的浏览器。
我遵循以下公式:。 https://www.you Programme.com/watch?v=-QFjJoRGCtU&t=332。
It only copied the first row to another worksheet. I m guessing I didn t define finalrow
properly.
Sub Search_Extract()
Dim resultnumber As Integer
Dim finalrow As Long
Dim datasheet As Worksheet, reportsheet As Worksheet
Dim i As Integer rowcounter
Set datasheet = Sheet4
Set reportsheet = Sheet3
resultnumber = reportsheet.Range("A1").Value
reportsheet.Range("D5:F7000").ClearContents
datasheet.Select
finalrow = Cells(Rows.Count, 3).End(xlUp).Row
For i = 1 To finalrow
If Cells(i, 3) = resultnumber Then
Range(Cells(i, 1), Cells(i, 3)).Copy
reportsheet.Select
Range("D6700").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
Next i
reportsheet.Select
End Sub