R1C1 formula help

Ody

Board Regular
Joined
Oct 14, 2010
Messages
215
I have the following code:


Dim LastSheet As String
LastSheet = Worksheets(Worksheets.Count).Name
With Worksheets("Summary")

lMaxRows = .Cells(.Rows.Count, "AA").End(xlUp).Row
.Range("aa" & lMaxRows + 1).Formula = "='" & LastSheet & "'!Bx7"

lMaxRows = .Cells(.Rows.Count, "AB").End(xlUp).Row
.Range("AB" & lMaxRows + 1).Formula = "='" & LastSheet & "'!Bx8"

ActiveCell.Offset(0, 10).FormulaR1C1 = "=RC27 & RC28"
My goal is to reference two cells from another sheet, then combine them at the bottom of my table in column "H". I'm having trouble with merging them, it seems to work once then I can't get it to give me the same results.

Thoughts?


ps
This is the best board on the net
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi Ody,

The first part of the code is putting references to the last sheet into the next row after the last data cell in Column AA and the next row after the last data cell in Column AB.

Assuming that these two cells are in the same row (which might not always be true), then the formula to combine them would be:

Code:
.Cells(lMaxRows+1,"H").FormulaR1C1 = "=RC27 & RC28"

The last statement in your posted code...
Code:
ActiveCell.Offset(0, 10).FormulaR1C1 = "=RC27 & RC28"
...will give you unpredictable results because ActiveCell isn't explicitly defined.

Good luck!
 
Upvote 0

Forum statistics

Threads
1,224,545
Messages
6,179,432
Members
452,915
Latest member
hannnahheileen

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