Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default Edit a Literal or Integer

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Edit a Literal or Integer

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Edit a Literal or Integer

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default Edit a Literal or Integer

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use CountIf for a literal string chadkwelch Excel Worksheet Functions 3 March 21st 10 03:45 AM
Literal based on Week end Umar Excel Worksheet Functions 5 December 26th 09 04:54 PM
How do I add an integer to an existing integer? Aaron Excel Worksheet Functions 3 December 17th 09 09:46 PM
edit a integer or literal Rick Excel Programming 0 November 19th 07 10:42 PM
How to use literal quotes with concatenation schieb Excel Discussion (Misc queries) 2 February 3rd 06 09:49 PM


All times are GMT +1. The time now is 07:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"