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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,215,373
Messages
6,124,544
Members
449,169
Latest member
mm424

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