Variable in R1C1

Analyze_This

Board Regular
Joined
Oct 29, 2008
Messages
122
I'm trying to set up a FOR NEXT loop with the variable X. (I know that you shouldn't set x as a variable, but it referrs to so many differnt things in the code that I couldn't think of a more descriptive name)
The problem that I have is that I can't seem to set the variable in an R1C1 formula because it of all the quotation marks. Here is how the formula currently looks

ActiveCell.FormulaR1C1 = "=""Late ""&TEXT(RC[2],""[H]:MM:SS"")"

The red 2 above is what I would like to place as x, but I can't seem to figure out the proper arrangement of quotation marks to make it work. Any ideas?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
It worked, but that was the first thing I tried before I posted. It seems that the key factor in making this work was adding in spaces before and after the ampersand (&). Is that necessary every time that you concatinate something? If it is why wouldn't VBA just add in the spaces like it does with everything else?
 
Upvote 0
Analyze This

I think the main thing is actually the doubling up the quotes surrounding 'Late'.

Though VBA can be a little fussy with spaces when concatenating.

And there seems to be no rhyme nor reason behind it's fussiness.:)
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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