Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DEE DEE is offline
external usenet poster
 
Posts: 250
Default Increment Cell Value on Worksheet Change

Hi,

In cell B3, I have a worksheet version number that starts with 1.

Various people view, edit and print the file. I would like the version
number to increment by 1 each time the worksheet is opened and changes are
made.

Perhaps triggered upon open and the person can either view and not keep
changes to cancel the incrementation, or make changes and save to keep it?

Any help would be greatly appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Increment Cell Value on Worksheet Change


Private Sub Workbook_Open()

With Worksheets("Sheet1").Range("B3")

.Value = .Valaue + 1
End With

End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
__________________________________
HTH

Bob

"Dee" wrote in message
...
Hi,

In cell B3, I have a worksheet version number that starts with 1.

Various people view, edit and print the file. I would like the version
number to increment by 1 each time the worksheet is opened and changes are
made.

Perhaps triggered upon open and the person can either view and not keep
changes to cancel the incrementation, or make changes and save to keep it?

Any help would be greatly appreciated!



  #3   Report Post  
Posted to microsoft.public.excel.programming
DEE DEE is offline
external usenet poster
 
Posts: 250
Default Increment Cell Value on Worksheet Change

Hi Bob,

Thanks for your response. I had tried something similar, but had input it
as a worksheet event.

I had also considered Worksheet_Change. Would this also work, or would it
increment at each and every change on the worksheet?

Thanks!

"Bob Phillips" wrote:


Private Sub Workbook_Open()

With Worksheets("Sheet1").Range("B3")

.Value = .Valaue + 1
End With

End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
__________________________________
HTH

Bob

"Dee" wrote in message
...
Hi,

In cell B3, I have a worksheet version number that starts with 1.

Various people view, edit and print the file. I would like the version
number to increment by 1 each time the worksheet is opened and changes are
made.

Perhaps triggered upon open and the person can either view and not keep
changes to cancel the incrementation, or make changes and save to keep it?

Any help would be greatly appreciated!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Increment Cell Value on Worksheet Change


"Dee" wrote in message
...
Hi Bob,

Thanks for your response. I had tried something similar, but had input it
as a worksheet event.

I had also considered Worksheet_Change. Would this also work, or would it
increment at each and every change on the worksheet?



Indeed it would.


  #5   Report Post  
Posted to microsoft.public.excel.programming
DEE DEE is offline
external usenet poster
 
Posts: 250
Default Increment Cell Value on Worksheet Change

Another question, if I may.

If I want this code to be easily available to users, what do you feel is the
best approach?

I had thought of adding a macro to the personal.xls that would input the
code to the active workbook, but would like a message to pop up asking which
cell contains the number and also what number they would like to start with.

Any advice on that?

Thanks!

"Bob Phillips" wrote:


"Dee" wrote in message
...
Hi Bob,

Thanks for your response. I had tried something similar, but had input it
as a worksheet event.

I had also considered Worksheet_Change. Would this also work, or would it
increment at each and every change on the worksheet?



Indeed it would.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Increment Cell Value on Worksheet Change

You have a real problem if you add Personal.xls as the code would work on
that workbook, not your target workbook. You could make it application code,
but then you would need some way of determining whether the active workbook
is one that you want this code to work on.

I am not a fan of plugging code into a workbook, you might make a non macro
enabled workbook macro enabled, and the user might not appreciate that. Plus
if the workbook is macro clean, the code won't fire when you plug it in.

--
__________________________________
HTH

Bob

"Dee" wrote in message
...
Another question, if I may.

If I want this code to be easily available to users, what do you feel is
the
best approach?

I had thought of adding a macro to the personal.xls that would input the
code to the active workbook, but would like a message to pop up asking
which
cell contains the number and also what number they would like to start
with.

Any advice on that?

Thanks!

"Bob Phillips" wrote:


"Dee" wrote in message
...
Hi Bob,

Thanks for your response. I had tried something similar, but had input
it
as a worksheet event.

I had also considered Worksheet_Change. Would this also work, or would
it
increment at each and every change on the worksheet?



Indeed it would.





  #7   Report Post  
Posted to microsoft.public.excel.programming
DEE DEE is offline
external usenet poster
 
Posts: 250
Default Increment Cell Value on Worksheet Change

I'm not sure if I was clear in my last post. I didn't mean that I would put
the code in the Personal.xls. What I meant was, I would add a macro to the
Personal.xls that would essentially add the code to the active workbook, with
a message box that would pop up, asking the user which cell they wish to
increment, which would in turn be modified in the code for that specific
workbook.

Basically, I'm looking for a way for users to run the macro to add the code
to their workbook so that they can do so easily as required.

I hope this makes sense!



"Bob Phillips" wrote:

You have a real problem if you add Personal.xls as the code would work on
that workbook, not your target workbook. You could make it application code,
but then you would need some way of determining whether the active workbook
is one that you want this code to work on.

I am not a fan of plugging code into a workbook, you might make a non macro
enabled workbook macro enabled, and the user might not appreciate that. Plus
if the workbook is macro clean, the code won't fire when you plug it in.

--
__________________________________
HTH

Bob

"Dee" wrote in message
...
Another question, if I may.

If I want this code to be easily available to users, what do you feel is
the
best approach?

I had thought of adding a macro to the personal.xls that would input the
code to the active workbook, but would like a message to pop up asking
which
cell contains the number and also what number they would like to start
with.

Any advice on that?

Thanks!

"Bob Phillips" wrote:


"Dee" wrote in message
...
Hi Bob,

Thanks for your response. I had tried something similar, but had input
it
as a worksheet event.

I had also considered Worksheet_Change. Would this also work, or would
it
increment at each and every change on the worksheet?


Indeed it would.






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
How to increment page number in a cell of worksheet Zubair Excel Discussion (Misc queries) 2 February 5th 10 01:46 PM
change formula- keep cell increment sheet numbers Ali Excel Discussion (Misc queries) 3 March 24th 09 09:31 AM
how to make a cell value increment every time a new worksheet is o mabari Excel Programming 1 June 30th 08 07:06 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM
Increment row change by two hotherps[_11_] Excel Programming 1 February 17th 04 08:29 PM


All times are GMT +1. The time now is 06:15 PM.

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

About Us

"It's about Microsoft Excel"