= sign error

kenpcli

Board Regular
Joined
Oct 24, 2017
Messages
129
I have this code: but when I hover over Payday it shows Payday = "="08-05 TO 08-11" and the code stops.

Payday = Application.InputBox(Prompt:="What is the Pay Period?", Type:=0)
ThisWorkbook.Sheets("HOURS BY ID").Range("G2:G1500").FormulaR1C1 = _
"=IFERROR(VLOOKUP(G2," & Payday & "$C:$Q,15,0)"
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
When building a formula, I like to do it manually first. Then, I comment it above the code line where I build the string. I then use Debug.Print to print a Run's result into VBE's Immediate window.

I don't what formula you expected from the input box or the input value. After the inputbox I would:
Code:
Debug.Print Payday

I don't know why you set R1C1 format the formula but used A1 format for its string assignment.
 
Upvote 0
I must be going about it wrong. What I am looking to do is add whatever tab name the user enters into the formula and copy down that column.
 
Upvote 0

Forum statistics

Threads
1,223,712
Messages
6,174,031
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top