An incremental number on an unsaveable worksheet

talis

New Member
Joined
Sep 24, 2014
Messages
36
I'm looking to add a incremental number to a worksheet, but this is to be on an unsaveable workbook. I've used the following code for the unsavable workbook:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)




ThisWorkbook.Saved = True


Cancel = True


End Sub






Private Sub Workbook_BeforeClose(Cancel As Boolean)


ThisWorkbook.Saved = True


End Sub


and I know I can use


Private Sub Worksheet_Activate() Range("A1") = Range("A1") + 1 Range("B1") = "times opened" 'customize RangeEnd Subto add an incremental number, but this code relies on the workbook being saved. Is there anyway to combine the two?</pre>
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Steph77

Board Regular
Joined
Sep 18, 2014
Messages
119
You could save a value to another saveable workbook and use that as the counter (as long as anyone who uses the workbook will have access to that network location)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,818
Messages
5,598,280
Members
414,223
Latest member
Accountant2B

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top