PC Review


Reply
Thread Tools Rate Thread

cell formula to change value by one

 
 
Alan R
Guest
Posts: n/a
 
      21st Oct 2011
excel 2003 in ( I9 ) there is a value 1000
I want to be be able to + 1 on close can anyone help
 
Reply With Quote
 
 
 
 
Cimjet
Guest
Posts: n/a
 
      21st Oct 2011
Hi Alan
This will do it...
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Range("i9").Value = Range("i9").Value + 1
End Sub
If you don't know where to place it.select the small XL icon to the left of the
File menu on top, right click select View Code. that should bring you to the VBA
editor in the Workbook Event module.
Just paste the macro on the big white page.
HTH
Cimjet

"Alan R" <(E-Mail Removed)> wrote in message
news:fdc3a5b1-5da5-42be-9194-(E-Mail Removed)...
> excel 2003 in ( I9 ) there is a value 1000
> I want to be be able to + 1 on close can anyone help


 
Reply With Quote
 
Cimjet
Guest
Posts: n/a
 
      21st Oct 2011
Hi again
The problem with the macro I gave you is that it will always increment by 1 at
closing. It's your choice but how about a macro that Ask you at opening if you
want to increment the number, then you can chose yes or no.
In any case here it is...
Don't use both delete one but they go at the same place.
Private Sub Workbook_Open()
answer = MsgBox("Do you want to Update Invoice number ?", vbYesNo)
If answer = vbNo Then Exit Sub
Range("i9").Value = Range("i9").Value + 1
ActiveWorkbook.Save
End Sub
HTH
Cimjet

"Alan R" <(E-Mail Removed)> wrote in message
news:fdc3a5b1-5da5-42be-9194-(E-Mail Removed)...
> excel 2003 in ( I9 ) there is a value 1000
> I want to be be able to + 1 on close can anyone help


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      21st Oct 2011
On Oct 20, 7:24*pm, "Cimjet" <cim...@newsgroup.org> wrote:
> Hi again
> The problem with the macro I gave you is that it will always increment by1 at
> closing. It's your choice but how about a macro that Ask you at opening if you
> want to increment the number, then you can chose yes or no.
> In any case here it is...
> Don't use both delete one but they go at the same place.
> Private Sub Workbook_Open()
> answer = MsgBox("Do you want to Update Invoice number ?", vbYesNo)
> * * If answer = vbNo Then Exit Sub
> Range("i9").Value = Range("i9").Value + 1
> ActiveWorkbook.Save
> End Sub
> HTH
> Cimjet
>
> "Alan R" <mastergasfit...@bellsouth.net> wrote in message
>
> news:fdc3a5b1-5da5-42be-9194-(E-Mail Removed)...
>
>
>
>
>
>
>
> > excel 2003 *in ( I9 ) there is a value 1000
> > I want to be be able to + 1 on close can anyone help


You may also want to specify the SHEET

Private Sub Workbook_Open()
answer = MsgBox("Do you want to Update Invoice number ?", vbYesNo)
* * If answer = vbNo Then Exit Sub

with sheets("sheet1"). Range("i9")
.Value = .Value + 1
end with

ActiveWorkbook.Save
End Sub


 
Reply With Quote
 
Cimjet
Guest
Posts: n/a
 
      21st Oct 2011
Hi Don
Hope you're doing well.
Thank you for the tip, it's not always sheet1 that the O.P. would use so, it's a
very good idea to specify the sheet name.
Thank you Don
Regards
Cimjet
"Don Guillett" <(E-Mail Removed)> wrote in message
news:7545528f-4466-45d7-b230-(E-Mail Removed)...
On Oct 20, 7:24 pm, "Cimjet" <cim...@newsgroup.org> wrote:
> Hi again
> The problem with the macro I gave you is that it will always increment by 1 at
> closing. It's your choice but how about a macro that Ask you at opening if you
> want to increment the number, then you can chose yes or no.
> In any case here it is...
> Don't use both delete one but they go at the same place.
> Private Sub Workbook_Open()
> answer = MsgBox("Do you want to Update Invoice number ?", vbYesNo)
> If answer = vbNo Then Exit Sub
> Range("i9").Value = Range("i9").Value + 1
> ActiveWorkbook.Save
> End Sub
> HTH
> Cimjet
>
> "Alan R" <mastergasfit...@bellsouth.net> wrote in message
>
> news:fdc3a5b1-5da5-42be-9194-(E-Mail Removed)...
>
>
>
>
>
>
>
> > excel 2003 in ( I9 ) there is a value 1000
> > I want to be be able to + 1 on close can anyone help


You may also want to specify the SHEET

Private Sub Workbook_Open()
answer = MsgBox("Do you want to Update Invoice number ?", vbYesNo)
If answer = vbNo Then Exit Sub

with sheets("sheet1"). Range("i9")
.Value = .Value + 1
end with

ActiveWorkbook.Save
End Sub


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:12 PM.