Thanks for the help. But how could I make a code that would change the numbers on serial basis?
Sub Insert_Next_SeqNbr()
Dim Nbr As Long
Nbr = GetSetting("XLInvoices", "Invoices", "NextNbr", 1)'If you want to start at some number other than 1, amend accordingly
If Right(ThisWorkbook.Name, 4) = ".xls" Then
With Sheets("Sheet1") 'Change sheet name as required
If .[A1] = "" Then 'Amend cell ref as required
Application.EnableEvents = False
.[A1] = Nbr 'Amend cell ref as required
Application.EnableEvents = True
SaveSetting "XLInvoices", "Invoices", "NextNbr", Nbr + 1
End If
End With
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [A1]) Is Nothing Then 'Amend cell ref as required
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
End If
End Sub
Sub Delete_SeqNbr_Registry_Entry()
On Error Resume Next
DeleteSetting "XLInvoices", "Invoices"
End Sub