patriciacosta
New Member
- Joined
- Sep 19, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
VBA Code:
ActiveCell.Formula2R1C1 = _
"=XLOOKUP(RC[-3]&RC[4]&RC[10]&RC[12]&RC[21],'[Payscale payroll.xlsx]Payscale'!R2C[-8]:R689C[-8]&'[Payscale payroll.xlsx]Payscale'!R2C[-6]:R689C[-6]&'[Payscale payroll.xlsx]Payscale'!R2C[-5]:R689C[-5]&'[Payscale payroll.xlsx]Payscale'!R2C[-4]:R689C[-4]&'[Payscale payroll.xlsx]Payscale'!R2C[-3]:R689C[-3],'[Payscale payroll.xlsx]Payscale'!R2C[-2]:R689C[-2])"
Range("I2").Select
Selection.Copy
Range("I3:I147").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("I2:I147").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("I2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
I'm learning how to use VBA so started using macro recorded. the attached formula works fine, but not always will go to row 689 or I147. I would like the range to go thru the last row, i tried add last row but it didnt work. If someone can help on this . thank you in advance
Last edited by a moderator: