Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Transporting Variable from macro to spreadsheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Newman - 28 Feb 2007 20:20 GMT
I have calculated a variable 'n' in a macro and want to put it into a
spreadsheet.
The expression ActiveCell.Formula = "= Max(R3Cn:R3C256)" doesn't work,
although substituting a number for n does work
Any solutions would be appreciated
Signature

Ken

Chip Pearson - 28 Feb 2007 20:28 GMT
Ken,

Try something like
ActiveCell.Formula = "= Max(R3C" & N & ":R3C256)"

Signature

Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

>I have calculated a variable 'n' in a macro and want to put it into a
> spreadsheet.
> The expression ActiveCell.Formula = "= Max(R3Cn:R3C256)" doesn't work,
> although substituting a number for n does work
> Any solutions would be appreciated
Dave Peterson - 28 Feb 2007 22:14 GMT
Although Chip's line of code may work, I bet he meant:

ActiveCell.FormulaR1C1 = "= Max(R3C" & N & ":R3C256)"

> Ken,
>
[quoted text clipped - 16 lines]
> > --
> > Ken

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.