Uzma Shaheen
Active Member
- Joined
- Nov 10, 2012
- Messages
- 484
- Office Version
- 365
- 2021
- Platform
- Windows
- Mobile
- Web
Hiya
Im trying to delete a column if the is a blank in the column however i get no results - Im using a table but its saying no blank cells found when there clearly is
Here is my code
Im trying to delete a column if the is a blank in the column however i get no results - Im using a table but its saying no blank cells found when there clearly is
Here is my code
Code:
Sub DeleteBlankRows(SheetName As String, TableName As String)
Dim Sh As Worksheet
Dim tbTable As ListObject
Dim lRow As Long
Set Sh = ThisWorkbook.Worksheets(SheetName)
Set tbTable = Sh.ListObjects(TableName)
tbTable.ListColumns("Group").DataBodyRange.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
lRow = Sh.Range("A:A").Find(WHat:="*", After:=Sh.Range("A1"), SearchDirection:=xlPrevious).Row
tbTable.Resize Sh.Range("A1:T" & lRow)
End Sub