Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's a toughfy? How does one edit the following to be the following by
using a macro? Sheet1End = 13 Sheet1End = 18 The macro has to take a count of 5 and add it to whatever Sheet1End 1st redition is equal to. Something like Sheet1End = Sheet1End + 5 and make it 18 so that the next time that the program is run again it starts off as Sheet1End = 18 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Not sure I get it, but if you are trying to store a value between multiple runs of a macro then you could use a cell to store the number. Eg, say Sheet2 is a hidden sheet. Sub Macro1() Dim theValue as Long ''' get the value theValue=Sheet2.Range("A1").value ''' run macro code ''' here ''' Now store the new value Sheet2.Range("A1").value = theValue + 5 End Sub Now, if Sheet1End correspond to the last row of data (ie you are trying to find the last row containing data in Sheet1), you can get that range using: Dim rgEnd as range set rgEnd = sheet1.Range("A:A").cells.count ''' get last cell of sheet1 in col A set rgEnd = rgEnd.End(xlUp) ''' go up until last cell of data msgbox rgEnd.Address I hope this helps, -- Regards, Sébastien <http://www.ondemandanalysis.com "Rick" wrote: Here's a toughfy? How does one edit the following to be the following by using a macro? Sheet1End = 13 Sheet1End = 18 The macro has to take a count of 5 and add it to whatever Sheet1End 1st redition is equal to. Something like Sheet1End = Sheet1End + 5 and make it 18 so that the next time that the program is run again it starts off as Sheet1End = 18 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Option Explicit
Dim oldvalue As Double Sub zerooldvalue()'reset oldvalue = 0 End Sub Sub doval() oldvalue = oldvalue + 5 MsgBox oldvalue End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Rick" wrote in message ... Here's a toughfy? How does one edit the following to be the following by using a macro? Sheet1End = 13 Sheet1End = 18 The macro has to take a count of 5 and add it to whatever Sheet1End 1st redition is equal to. Something like Sheet1End = Sheet1End + 5 and make it 18 so that the next time that the program is run again it starts off as Sheet1End = 18 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Guy's for trying to answer my querry. I had a feeling that no
permenate edit could be done on a macro by a macro. Maybe someday MS will come up with a way. "Rick" wrote: Here's a toughfy? How does one edit the following to be the following by using a macro? Sheet1End = 13 Sheet1End = 18 The macro has to take a count of 5 and add it to whatever Sheet1End 1st redition is equal to. Something like Sheet1End = Sheet1End + 5 and make it 18 so that the next time that the program is run again it starts off as Sheet1End = 18 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Use CountIf for a literal string | Excel Worksheet Functions | |||
Literal based on Week end | Excel Worksheet Functions | |||
How do I add an integer to an existing integer? | Excel Worksheet Functions | |||
edit a integer or literal | Excel Programming | |||
How to use literal quotes with concatenation | Excel Discussion (Misc queries) |