Hello all,
I've just recently began playing around in Excel and I'm struggling to figure this out. I've tried several variations of what I copied below, but I believe my understanding to be flawed. What I need to do is first filter the data to only include adjustments (ending in U1, U2, etc.). I then perform a Vlookup comparing the adjustment to the original payment and changing the date on the adjustment (Column M) to the original pay date found in a separate workbook.
I've tried several attempts, but the following is my most recent attempt. I thought this would loop through the visible cells in column M starting at M2 to avoid the header row and update the value to the vlookup I have. But instead, this applies the macro to M1 only. Any help is appreciated.
A couple notes, the affected rows - some will be contiguous, some will not. The full data is usually around 1500 rows and the filtered data is around 100, but these numbers need to be dynamic.
Additionally, I need to then copy and paste the affected cells as values afterwards, but I believe that to be a separate task.
I've just recently began playing around in Excel and I'm struggling to figure this out. I've tried several variations of what I copied below, but I believe my understanding to be flawed. What I need to do is first filter the data to only include adjustments (ending in U1, U2, etc.). I then perform a Vlookup comparing the adjustment to the original payment and changing the date on the adjustment (Column M) to the original pay date found in a separate workbook.
I've tried several attempts, but the following is my most recent attempt. I thought this would loop through the visible cells in column M starting at M2 to avoid the header row and update the value to the vlookup I have. But instead, this applies the macro to M1 only. Any help is appreciated.
A couple notes, the affected rows - some will be contiguous, some will not. The full data is usually around 1500 rows and the filtered data is around 100, but these numbers need to be dynamic.
Code:
Sub Macro() Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
ActiveSheet.Range("$A$1:$W$" & Lastrow).AutoFilter Field:=5, Criteria1:="=*u*"
For Each cell In Range("M2:M" & Lastrow).SpecialCells(xlCellTypeVisible)
cell.Value = "=VLOOKUP(LEFT(RC[-8],10),[export.XLSX]Sheet1!C1:C2,2,FALSE)"
Next cell
End Sub
Additionally, I need to then copy and paste the affected cells as values afterwards, but I believe that to be a separate task.