Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting
How can I add something to a variable each time I run the macro? So
basically, I have a variable called CountRows, and each time I run the macro, I want CountRows to increase by a certain number (different each time it is ran). I just want it to keep a tally. So I have another variable called Rows. I thought I could do the following: CountRows = CountRows + Rows Then the next time it is ran for a different sheet, it will remember what was in CountRows and add the new Rows number to it. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting
Hi Mike,
One way, try something like: '============== Sub Tester02() Dim iRows As Long Static countRows As Long iRows = Cells(Rows.Count, "A").End(xlUp).Row countRows = countRows + iRows End Sub '<<============== --- Regards, Norman "Mike" wrote in message ... How can I add something to a variable each time I run the macro? So basically, I have a variable called CountRows, and each time I run the macro, I want CountRows to increase by a certain number (different each time it is ran). I just want it to keep a tally. So I have another variable called Rows. I thought I could do the following: CountRows = CountRows + Rows Then the next time it is ran for a different sheet, it will remember what was in CountRows and add the new Rows number to it. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting
THANK YOU!
"Norman Jones" wrote: Hi Mike, One way, try something like: '============== Sub Tester02() Dim iRows As Long Static countRows As Long iRows = Cells(Rows.Count, "A").End(xlUp).Row countRows = countRows + iRows End Sub '<<============== --- Regards, Norman "Mike" wrote in message ... How can I add something to a variable each time I run the macro? So basically, I have a variable called CountRows, and each time I run the macro, I want CountRows to increase by a certain number (different each time it is ran). I just want it to keep a tally. So I have another variable called Rows. I thought I could do the following: CountRows = CountRows + Rows Then the next time it is ran for a different sheet, it will remember what was in CountRows and add the new Rows number to it. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
counting function but not double counting duplicates | Excel Worksheet Functions | |||
Help Counting | Excel Worksheet Functions | |||
Counting rows, then counting values. | Excel Discussion (Misc queries) | |||
Counting Rows Then Counting Values in Columns | Excel Programming | |||
Counting names in a column but counting duplicate names once | Excel Discussion (Misc queries) |