JohnZ1156
Board Regular
- Joined
- Apr 10, 2021
- Messages
- 160
- Office Version
- 2021
- Platform
- Windows
I'm trying to get VBA to insert a formula into the active cell with the following line of code where LR is the last Row number
=VLOOKUP(I7021,$R$18:$T$137,2)
To test I entered
MsgBox "I" & lr and it shows the cell I7021 which is column I and row 7021 in the message box.
But when I try to use this line of code to get the following formula entered into the active cell, it doesn’t work.
ActiveCell.Formula = "=VLOOKUP("I" & lr,$R$18:$T$137,2)"
I have a feeling this is an easy one, but I know I'm missing something stupid.
=VLOOKUP(I7021,$R$18:$T$137,2)
To test I entered
MsgBox "I" & lr and it shows the cell I7021 which is column I and row 7021 in the message box.
But when I try to use this line of code to get the following formula entered into the active cell, it doesn’t work.
ActiveCell.Formula = "=VLOOKUP("I" & lr,$R$18:$T$137,2)"
I have a feeling this is an easy one, but I know I'm missing something stupid.