ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Morning,
Please can you advise on the issue i have.
If i put this code on a command button & it works fine.
BUT
I have inserted it within an existing code that i use as shown below but the table row isnt deleted when X is in column S
Everything else in the code below works.
Please can you advise on the issue i have.
If i put this code on a command button & it works fine.
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 = 19 And ActiveCell.Row > 3 And ActiveCell.Value = "X" Then
ActiveTableRow = Selection.Row - Selection.ListObject.Range.Row
Selection.ListObject.ListRows(ActiveTableRow).Delete
End If
End Sub
BUT
I have inserted it within an existing code that i use as shown below but the table row isnt deleted when X is in column S
Everything else in the code below works.
Rich (BB code):
Private Sub SUMMARYTRANSFER()
Dim rFndCell As Range
Dim stFnd As String
Dim fRow As Long
Dim sh As Worksheet
Dim ws As Worksheet
Dim tbl As ListObject
Dim R As Long
Dim lr As Long
Dim i As Long
Dim ActiveTableRow As Long
Set ws = Sheets("G INCOME")
Set sh = Sheets("G SUMMARY")
stFnd = ws.Range("A3").Value
With sh
Set rFndCell = .Range("C5:C17").Find(stFnd, LookIn:=xlValues, LookAt:=xlWhole)
If Not rFndCell Is Nothing Then
fRow = rFndCell.Row
sh.Cells(fRow, 4).Resize(, 1).Value = ws.Range("D31").Value
sh.Cells(fRow, 5).Resize(, 1).Value = ws.Range("E31").Value
Else
MsgBox Range("A3") & vbNewLine & "WAS NOT FOUND IN THE RANGE", vbCritical + vbOKOnly, "NO MONTH IN SUMMARY SHEET RANGE"
Worksheets("G SUMMARY").Activate
Worksheets("G SUMMARY").Range("D3").Select
Exit Sub
End If
MsgBox "TRANSFER TO SUMMARY SHEET ALSO COMPLETED", vbInformation + vbOKOnly, "SUMMARY TO TRANSFER SHEET COMPLETED MESSAGE"
Sheets("G INCOME").Range("A5:B30").ClearContents
Range("A3").MergeArea.ClearContents
Range("C3").ClearContents
Range("E3").ClearContents
Range("A5").Select
End With
If ActiveCell.Column = 19 And ActiveCell.Row > 3 And ActiveCell.Value = "X" Then
ActiveTableRow = Selection.Row - Selection.ListObject.Range.Row
Selection.ListObject.ListRows(ActiveTableRow).Delete
End If
INCOMEMONTHYEAR.Show
End Sub