ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Incrementing by 1 when doc is opened (https://www.excelbanter.com/excel-worksheet-functions/71943-incrementing-1-when-doc-opened.html)

Jenner

Incrementing by 1 when doc is opened
 
I am trying to increment a number by one every time the document is opened -
will I need to make a macro? I am new with macros and know not much about
them. Please can someone help - the original document is in word, but I'm
not sure if you can increment in word - it would be good if I could though -
I would rather use word then excel but if can't be done, excel will have to
do.

Thanks

Jenner

Sloth

Incrementing by 1 when doc is opened
 
I believe you will have to use a macro like this...

Private Sub Workbook_Open()
Range("A1").Formula = Range("A1").Value + 1
ActiveWorkbook.Save
End Sub

Insert this code under "ThisWorkbook". You will need to change the A1 to
the desired cell you want incremented. The "ActiveWorkbook.Save" may not be
necessary, depending on what you want. If someone opened the file and didn't
save, it would not record the change without that command.

"Jenner" wrote:

I am trying to increment a number by one every time the document is opened -
will I need to make a macro? I am new with macros and know not much about
them. Please can someone help - the original document is in word, but I'm
not sure if you can increment in word - it would be good if I could though -
I would rather use word then excel but if can't be done, excel will have to
do.

Thanks

Jenner


Jenner

Incrementing by 1 when doc is opened
 
Thanks for your help - I will try that.

"Sloth" wrote:

I believe you will have to use a macro like this...

Private Sub Workbook_Open()
Range("A1").Formula = Range("A1").Value + 1
ActiveWorkbook.Save
End Sub

Insert this code under "ThisWorkbook". You will need to change the A1 to
the desired cell you want incremented. The "ActiveWorkbook.Save" may not be
necessary, depending on what you want. If someone opened the file and didn't
save, it would not record the change without that command.

"Jenner" wrote:

I am trying to increment a number by one every time the document is opened -
will I need to make a macro? I am new with macros and know not much about
them. Please can someone help - the original document is in word, but I'm
not sure if you can increment in word - it would be good if I could though -
I would rather use word then excel but if can't be done, excel will have to
do.

Thanks

Jenner


Jenner

Incrementing by 1 when doc is opened
 
Hi,

Do you know if you can increment in word? Do I put the same macro in as
below?

thanks

Jenner

"Sloth" wrote:

I believe you will have to use a macro like this...

Private Sub Workbook_Open()
Range("A1").Formula = Range("A1").Value + 1
ActiveWorkbook.Save
End Sub

Insert this code under "ThisWorkbook". You will need to change the A1 to
the desired cell you want incremented. The "ActiveWorkbook.Save" may not be
necessary, depending on what you want. If someone opened the file and didn't
save, it would not record the change without that command.

"Jenner" wrote:

I am trying to increment a number by one every time the document is opened -
will I need to make a macro? I am new with macros and know not much about
them. Please can someone help - the original document is in word, but I'm
not sure if you can increment in word - it would be good if I could though -
I would rather use word then excel but if can't be done, excel will have to
do.

Thanks

Jenner



All times are GMT +1. The time now is 12:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com