Can anyone tell me how to make it so the code works below for all worksheets?
Sub cutaneous()
N = Cells(Rows.Count, "A").End(xlUp).Row
Range("AM1").Formula = "=VLOOKUP(C2,Summary!A:C,3)"
Range("AM1").Copy Range("AM2:AM" & N)
End Sub
I tried:
Sub cutaneous()
Dim ws As Worksheet
For Each ws In Worksheets
With ws
N = Cells(Rows.Count, "A").End(xlUp).Row
End With
ws.Range("AM2").Formula = "=VLOOKUP(C2,Summary!A:C,3)"
ws.Range("AM2").Copy ws.Range("AM2:AM" & N)
Next ws
End Sub
but this finds the range of the first sheet and uses that same range on every sheet
Bookmarks