Reputation: 3
I have successfully run this macro before and now I am receiving a Mismatch error.
The macro copies all rows from a Data Tab (data-raw) where Col S = Cell D1 (on a different tab). Then pastes special values to a third tab (Rec01).
D1, formatted as General with Text data (name) Col S, formatted as General, all formulas, displaying a name.
Sub CopyRowToRec01()
Dim LastRowData, LastRowRec01 As Long
Dim i As Long
Application.ScreenUpdating = False
LastRowData = Worksheets("data-raw-Comb").Range("A" & Rows.Count).End(xlUp).Row
With Worksheets("data-raw-Comb")
For i = 2 To LastRowData Step 1
If Cells(i, "S").Value = Worksheets("data-lookuptable").Range("D1") Then
LastRowRec01 = Worksheets("Rec01").Range("A" & Rows.Count).End(xlUp).Row
Rows(i).Copy
Worksheets("Rec01").Range("A" & LastRowRec01 + 1).PasteSpecial Paste:=xlPasteValues
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
Running same version of Excel. Any insight would be greatly appreciated. DD
Upvotes: 0
Views: 34
Reputation: 3
If Cells(i, "S").Value = Worksheets("data-lookuptable").Range("D1") Then
Thank you every for your responses. I am not sure what changed from last time, but I had to change the .Value
to .Text
. Now it is running again, all data being pulled.
Sorry to bother. Thanks again
Upvotes: 0