Hi
I would appreciate some help on the following problem, I have made a Excel table within a worksheet, wish to be able to allow the user to enter on a date, or leave a blank and delete the appropriate table row on the table when I ran the program it deleted row 10 of the worksheet, not the appropriate row on the table without affecting any other columns on worksheet.
Format that I am using is below followed by the program code that I was trying to achieve
Sub CellRowLoop()
Application.ScreenUpdating = False ' to make the program run faster
Dim lo As ListObject
idate = ActiveWorkbook.Worksheets("Sheet1").Range("d6") ' is the criteria on which the row is to be deleted
Set lo = Sheet1.ListObjects("tableentry")
For rw = lo.DataBodyRange.Rows.Count To 1 Step -1
If lo.DataBodyRange(rw, 3) = idate Then
lo.ListRows(rw).Delete
End If
Next
Application.ScreenUpdating = True
End Sub
I would appreciate some help on the following problem, I have made a Excel table within a worksheet, wish to be able to allow the user to enter on a date, or leave a blank and delete the appropriate table row on the table when I ran the program it deleted row 10 of the worksheet, not the appropriate row on the table without affecting any other columns on worksheet.
Format that I am using is below followed by the program code that I was trying to achieve
Sub CellRowLoop()
Application.ScreenUpdating = False ' to make the program run faster
Dim lo As ListObject
idate = ActiveWorkbook.Worksheets("Sheet1").Range("d6") ' is the criteria on which the row is to be deleted
Set lo = Sheet1.ListObjects("tableentry")
For rw = lo.DataBodyRange.Rows.Count To 1 Step -1
If lo.DataBodyRange(rw, 3) = idate Then
lo.ListRows(rw).Delete
End If
Next
Application.ScreenUpdating = True
End Sub