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
 

Some videos you may like

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Snakehips

Well-known Member
Joined
May 17, 2009
Messages
5,069
Office Version
  1. 2013
Platform
  1. Windows
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.
 

Richard in Redditch

New Member
Joined
Feb 7, 2012
Messages
44
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.
 

Snakehips

Well-known Member
Joined
May 17, 2009
Messages
5,069
Office Version
  1. 2013
Platform
  1. Windows
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!
 

Richard in Redditch

New Member
Joined
Feb 7, 2012
Messages
44
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,371
Messages
5,595,782
Members
414,020
Latest member
Meghdad

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
Top