Reputation: 21
Hi I am trying to pass a variable inside the below line but apparently its the wrong way. Can someone please guide me in the right direction please :)
Dim variable as string
variable = "something"
ActiveCell.FormulaR1C1 = "=if([@Column1]=" & variable & ", TRUE, FALSE)"
Upvotes: 1
Views: 42
Reputation: 166351
Try:
Dim variable as string
variable = "something"
ActiveCell.Formula = "=if([@Column1]=""" & variable & """, TRUE, FALSE)"
You need to add the quotes around your variable (and embedded quotes need to be doubled-up to escape them)
Upvotes: 1