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>
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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)
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,239
Members
448,555
Latest member
RobertJones1986

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
Back
Top