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 / December 2007

Tip: Looking for answers? Try searching our database.

Macro Help with Variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben - 11 Dec 2007 17:51 GMT
I calculate my variable counter by counting the number of rows in the
previous worksheet. The value ends up being 107, which is correct.

The problem I have is that I have to later functions I want to use that have
a varying number of rows and I want use the counter variable as the row
number. Basically, I want the statement below to work, except replacing the
107 with counter.  

'First Shift Failure Data
x = 2
Do While Cells(x, 1).Value <> ""
Cells(x, 5).Value =
"=SUMPRODUCT(--(Data!R3C[4]:R[107]C[4]=""FIRST""),--(Data!R3C[5]:R[107]C[5]=RC1))"
x = x + 1
Loop

Any help is appreciated
John Bundy - 11 Dec 2007 18:36 GMT
assuming "counter" is the name of your variable, try changing your formula to
this
"=SUMPRODUCT(--(Data!R3C[4]:R[" & counter &
"]C[4]=""FIRST""),--(Data!R3C[5]:R[" & counter & "]C[5]=RC1))"

Signature

-John
Please rate when your question is answered to help us and others know what
is helpful.

> I calculate my variable counter by counting the number of rows in the
> previous worksheet. The value ends up being 107, which is correct.
[quoted text clipped - 13 lines]
>
> Any help is appreciated
 
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.