user2786962
user2786962

Reputation: 469

Refer to a sheet whose name is stored in a variable

I need to refer to a sheet whose name is stored in variable J

ActiveCell.FormulaR1C1 = "=VLOOKUP(R[-1]C,' " & J & " '!R32C1:R" & row_count & "C32,2,0)"

I am using the following formula but it is not working

Upvotes: 0

Views: 61

Answers (1)

Rory
Rory

Reputation: 34035

You need to remove the spaces after the apostrophes:

ActiveCell.FormulaR1C1 = "=VLOOKUP(R[-1]C,'" & J & "'!R32C1:R" & row_count & "C32,2,0)"

Upvotes: 2

Related Questions