Results 1 to 4 of 4

Auto Numbering when Row Deleted.

Threaded View

  1. #1
    Registered User
    Join Date
    04-02-2020
    Location
    Philippines
    MS-Off Ver
    version 1902
    Posts
    33

    Auto Numbering when Row Deleted.

    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
    Last edited by Pepe Le Mokko; 04-29-2020 at 08:23 AM. Reason: Replace quote with code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Automatic numbering when rows inserted or deleted but with a difference
    By FIONAL12 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-31-2019, 12:10 PM
  2. Multi level reference id - auto numbering - similar to legal numbering
    By smsko in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-11-2017, 06:05 AM
  3. [SOLVED] Timestamp Formula Auto Deleted when Using Macro
    By emmieshane in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-18-2017, 07:29 PM
  4. weird (auto numbering) numbering ....
    By freestone in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-20-2010, 07:46 PM
  5. Possible to do auto-numbering after auto filtering?
    By hello_lpc in forum Excel General
    Replies: 1
    Last Post: 11-10-2009, 03:18 AM
  6. Button auto deleted
    By dinga in forum Excel General
    Replies: 3
    Last Post: 11-15-2008, 08:40 PM
  7. WBS numbering help, auto numbering with indenture
    By hisham2929 in forum Excel General
    Replies: 2
    Last Post: 02-18-2007, 06:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1