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 2006

Tip: Looking for answers? Try searching our database.

Using variables while running macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TheLeafs - 28 Feb 2006 14:02 GMT
Good day folks,

I have this code:

termmon = Month(Sheets("Main").Cells(9, 3)) + 1
Range("J30").Select
ActiveCell.FormulaR1C1 = "=HLOOKUP(""5 Days"",R[0]C[-8]:R[18]C[-2],
termmon, FALSE)"

When I try to use the variable "termmon" in the hlookup formula, I get
the #Name? in the active cell.  I tried to copy and pastevalues in the
active cell but still the same thing happen.  Do anyone know if there
is a way to get this to work?

Thank you

Chris

Signature

TheLeafs

Chip Pearson - 28 Feb 2006 14:26 GMT
Try

ActiveCell.FormulaR1C1 = "=HLOOKUP(""5
Days"",R[0]C[-8]:R[18]C[-2]," & _
   termmon & ", FALSE)"

Signature

Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"TheLeafs"

>
> Good day folks,
[quoted text clipped - 18 lines]
>
> Chris
TheLeafs - 28 Feb 2006 14:47 GMT
 
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.