hi,
I got a formula to increment the number ie. =OFFSET(A3,1,O)+1
but i am searching how to do by code so that no user can delete the formula
recently i saw a code that is incrementing the number to the next line, what i am
looking for one number more than A4 . If A4 is 999 , A3 to show 1000.
Below the code i saw in another thread, is it possible to alter the code and use for me . Any help is highly appreciated.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim newval As Long
'test if its in the table
If Range("B1").End(xlDown).Address = Target.Address Then
If Target.Offset(0, -1).Value = "" Then
newval = Target.Offset(-1, -1).Value + 1
Do While WorksheetFunction.CountIf(Range("A:A"), newval) > 0
newval = newval + 1
Loop
Target.Offset(0, -1).Value = newval
End If
End If
End Sub
thanks and regards
nowfal
Bookmarks