Excel - Count each time workbook opened

  Zak 21:40 01 Apr 2004
Locked

Is there a VBA Macro to do the following:

In a predetermined cell a count each time the workbook is opened.

Could this also be used for a user form, i.e. each time a new form is raised?

Finally if there is a solution will it work on both Excel 97 and 2000?

  VoG II 21:43 01 Apr 2004

Sub Auto_Open

Sheets("Sheet1").Range("A1").Value = Sheets("Sheet1").Range("A1").Value + 1

End Sub

  VoG II 21:43 01 Apr 2004

Sub Auto_Open

Sheets("Sheet1").Range("A1").Value = Sheets("Sheet1").Range("A1").Value + 1

End Sub

  Zak 21:58 01 Apr 2004

Thanks VoG, but cannot get it to work in Excel97, haven;t tried 2000.

I pasted the code both in worksheet module and tried in workbook module. I entered 1 in cell A1, saved and closed. On opening file no change to cell A1.

I must be going wrong somewhere, so please confirm if above steps are in fact correct or wrong.

Thanks for your patience.

  VoG II 22:05 01 Apr 2004

That code will work in all versions of Excel from Excel 5 up.

Start Excel and open your workbook. ALT + F11 to open the VBA editor. Insert/Module. Paste the code in there. ALT+F11 to return to Excel. Save and close the workbook. Then open it again and the cell value should have changed.

No probs regarding patience - from the nature of your question I assumed that you would know what to do with the code.

  Zak 22:35 01 Apr 2004

Many thanks VoG, followed your instructions to the letter and it works perfectly.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

OnePlus 5 review

Alice Saey's mesmerising animation for Dutch singer Mark Lotterman

iPad Pro 10.5in (2017) review

Comment booster votre iPhone ?