Insert fumctions in other sheets where the address of the target cell varies

Richard in Redditch

New Member
Joined
Feb 7, 2012
Messages
44
Hello.
I have an application where I want to put a formula in one sheet of a workbook where the formula addresses another sheet. I am trying to use code such as this:
ActiveCell.Formula = "=summary! & Cells(LastRowNo + 1, 5)". Although I know this syntax is incorrect, I hope it is sufficiently apparent so that my intention is clear. Please can anyone help?
Richard
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Richard,

Try like...
Code:
     ActiveCell.Formula = "='summary'!" & Cells(LastRowNo + 1, 5).address

I assume you are ok to establish the variable LastRowNo ?

Hope that helps.
 
Upvote 0
Hello again - and many thanks as well!

Now the code works like a dream. I couldn't find any reference to the .address modifier in any of my Excel books (I use Excel 2013 on W7), so can you point me in the direction of any good ones?

Thanks again from one happy bunny.
 
Upvote 0
You are welcome.

As for books here is a link to HIKER"S LIST which lists a variety of resources.

I've not been a big user of Excel books. Google is your friend especially YouTube.
And there is a lot to be learned from the forum of course.

When you type e.g. ActiveCell. in the vb editor you should get a dropdown of available methods and properties.
Same when you have variables if you have declared their type.
Also Google use of the vb editor's Object Browser.

Enjoy!
 
Upvote 0
Hello
A very big "thank you" to everybody who has helped me out with the answer to my query. I did accidentally post it twice - I thought I had not got it right the first time, so apologies to anyone who thought I was taking the mickey. What a wonderful forum!
Richard
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,981
Members
449,058
Latest member
oculus

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