PDA

View Full Version : [SOLVED] Delete Rows in Table



marco6325
06-03-2018, 03:11 AM
Good morning everyone!

I have a table in the sheet called (Data), this table has information in manycolumns, but I need you to evaluate Good to all!

I have a table in the sheet called (Data), this table has information in manycolumns, but I need you to evaluate column B and if the value of that column iszero or empty, delete the entire row, I have this code, but run it, the Macroidentifies the cell as empty, goes to the delete command, "supposedlyeliminates", but when I see the table, there are still the rows, can youhelp me?
column B and if the value of that column is zero or empty, delete theentire row, I have this code, but when running it, the Macro identifies thecell as empty, goes to the delete command, "supposedly eliminates",but when I see the table, are the rows still, can you help me?


…….”



Dim uu As Integer

Dim ult As Long

Dim www As Long



Worksheets("Data").Select

www =WorksheetFunction.CountA(Range("A:A"))

Set LO =Sheets("Data").ListObjects("Table1")

LO.DataBodyRange.Select

ult = Cells(Rows.Count, 2).End(xlUp).Row

For uu = ult To 8 + www Step -1

If .Cells(uu, 2) = "" Then.Cells(uu, 1).EntireRow.Delete



…”
Thanks in advance!

NoSparks
06-03-2018, 09:27 AM
delete table rows instead of sheet rows


Set LO = Sheets("Data").ListObjects("Table1")
With LO
ult = .ListRows.Count
For uu = ult To 1 Step -1
If .DataBodyRange.Cells(uu, 2) = "" Then .ListRows(uu).Delete
Next uu
End With

marco6325
06-04-2018, 02:21 AM
THANKS!!! NoSparks!! Good Job!!