MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Increment a Counter Everytime a Userform is Opened

May 25, 2002 - by Juan Pablo Gonzalez

Roger asks:

We are racking our brains here trying to design a form in Excel that automatically increments the number (i.e. 5600) by one each time the form is opened. Is there a formula or macro that will accomplish this task?

In the Workbook module (Or, if it’s a Userform, in the Initialize event of that Userform) put the following:

Private Sub Workbook_Open()
	Sheet1.Range("A1") = Sheet1.Range("A1") + 1
End Sub