Hi i have this excel database with numbering
1. data
2. data
3. data
4. data
whenever i delete example number 2. it will ruin the numbering
1. data
3. data
4. data
how can i make it auto adjust the numbering if i delete some rows
here's my vba code on delete.
Private Sub cmdDelete_Click()
Dim iRow As Long
If Selected_List = 0 Then
MsgBox "No Row is Selected.", vbOKOnly + vbInformation, "Delete"
Exit Sub
End If
Dim i As VbMsgBoxResult
i = MsgBox("Warning!!!. Do you want to (Delete) the selected Record?", vbYesNo + vbQuestion, "Confirmation")
If i = vbNo Then Exit Sub
iRow = Application.WorksheetFunction.Match(Me.lstDatabase.List(Me.lstDatabase.ListIndex, 0), _
ThisWorkbook.Sheets("Database").Range("A:A"), 0)
ThisWorkbook.Sheets("Database").Rows(iRow).Delete
Call Reset
MsgBox "Selected record has been deleted.", vbOKOnly + vbInformation, "Deleted"
End Sub
Bookmarks