How to change a relative cell address row, Ex: "=RC[1]&RC[2]" to absolute address in a do loop

jkalpus

New Member
Joined
Apr 17, 2004
Messages
46
Greetings. I need to concatenate two cells using VBA, but keep ONE of those cell address absolute (the R[1].
I also need to have the code loop through the cells until finished.
Here's what I've got so far.

Do
ActiveCell.FormulaR1C1 = "=RC[1]&RC[2]"
ActiveCell.Offset(1, 0).Range("A1").Select

Loop Until IsEmpty(ActiveCell.Offset(0, 2)) = True

I've tried simply removing the [] which I thought turns the cell address into absolute. It's not working.
What, please, am I missing here??? I'm using Excel 2013.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Depending whre Activecell is to start with, you wiil need to change it to...
so assuming activecell is in row 1, it will be
Code:
ActiveCell.Formula = "=B1&C1"

Might be better to post ALL the code !
 
Upvote 0
Greetings. I need to concatenate two cells using VBA, but keep ONE of those cell address absolute (the R[1].
I also need to have the code loop through the cells until finished.
Here's what I've got so far.

Do
ActiveCell.FormulaR1C1 = "=RC[1]&RC[2]"
ActiveCell.Offset(1, 0).Range("A1").Select

Loop Until IsEmpty(ActiveCell.Offset(0, 2)) = True

I've tried simply removing the [] which I thought turns the cell address into absolute. It's not working.
What, please, am I missing here??? I'm using Excel 2013.
The square brackets are an offset from the reference cell which, in your case is the ActiveCell wherever that may be, so removing the square brackets ignores the ActiveCell reference and fixes the location at Columns A and B. I think this will place the correct formula in the ActiveCell for you...

ActiveCell.FormulaR1C1 = "=RC" & ActiveCell.Column + 1 & "&RC" & ActiveCell.Column + 2
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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