ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,683
- Office Version
- 2007
- Platform
- Windows
I have the code shown below "MINUS RED TEXT" which when i select a customer in column A it deletes it fine.
I need the user to check if he actually has selected the correct customer to delete so,
I added the code in RED to try & show a Msgbox with the customers name taken from what the user had selected in column A but im getting confused.
I need the user to check if he actually has selected the correct customer to delete so,
I added the code in RED to try & show a Msgbox with the customers name taken from what the user had selected in column A but im getting confused.
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
Dim ActiveTableRow As Long
If ActiveCell.Column = 1 Then
MsgBox("DELETE CUSTOMER " & ActiveCell.Value & "?", vbYesNo + vbInformation, "DELETE CUSTOMER FROM DATABASE") = vbYes Then
ActiveTableRow = Selection.Row - Selection.ListObject.Range.Row
Selection.ListObject.ListRows(ActiveTableRow).Delete
MsgBox "CUSTOMER NOW DELETED", vbInformation, "CUSTOMER DELETED MESSAGE"
Else
MsgBox "YOU MUST SELECT CUSTOMER IN COLUMN A", vbCritical, "NO CUSTOMER WAS SELECTED"
End If
End Sub