Delete extra cell in currently working code

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
This is the code in use.

My question is,
Currently when the row is deleted it deletes the contents of cells N - R
Ive put an "X" in column M next to some customers names to remind me at the end of the month that this customer must be deleted.

So im trying to see how when the code deletes the row its now needs to also include deleting the X thus being M - R


Rich (BB code):
Private Sub DeleteCustomer_Click()
    Dim tblName As String
    Dim tbl As ListObject
    Dim r As Long
    Dim lr As Long
    Dim i As Long
    
    If ActiveCell.Column = 14 And ActiveCell.Row > 3 And ActiveCell.Value <> "" Then
        If MsgBox("ARE YOU SURE YOU WISH TO DELETE THIS CUSTOMER", vbYesNo + vbCritical, "DELETE GRASS CUTTING CUSTOMER") = vbYes Then
            ActiveCell.Resize(1, 5).Delete
        Else
           MsgBox "NO CUSTOMER WAS SELECTED", vbExclamation, "DELETE GRASS CUTTING CUSTOMER"
        End If
    End If
    '   Enter table name below
    tblName = "Table1"

'   Set table object
    Set tbl = ActiveSheet.ListObjects(tblName)
    
'   Count rows in table
    r = tbl.Range.Rows.Count
    
'   Insert rows if rows if less than 30
    If r < 30 Then
'       Add needed rows to table
        For i = 1 To (32 - r)
            tbl.ListRows.Add
        Next i
    End If
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
How about this?
VBA Code:
        If MsgBox("ARE YOU SURE YOU WISH TO DELETE THIS CUSTOMER", vbYesNo + vbCritical, "DELETE GRASS CUTTING CUSTOMER") = vbYes Then
            ActiveCell.Resize(1, 5).Delete
            If ActiveCell.Offset(0, -1).Value = "X" Then
                ActiveCell.Offset(0, -1).Delete
            End If
        Else
           MsgBox "NO CUSTOMER WAS SELECTED", vbExclamation, "DELETE GRASS CUTTING CUSTOMER"
        End If
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,249
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top