gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,341
- Office Version
- 365
- Platform
- Windows
I have this code that seems to work for everything except deleting rows if DSRationale is blank
I checked the table field name and it is "DSRationale"
I know the tab name and table name is correct because the code does delete rows if "CostSourceId" is blank.
Does anyone see where I made the mistake? Its not deleting rows where the DSRationale is blank. Thanks!!
I checked the table field name and it is "DSRationale"
I know the tab name and table name is correct because the code does delete rows if "CostSourceId" is blank.
Does anyone see where I made the mistake? Its not deleting rows where the DSRationale is blank. Thanks!!
Code:
Sub TestThis()
'Remove Blanks and Dups
'Remove Duplicates
Range("DownSelectTable[#All]").Select
ActiveSheet.Range("DownSelectTable[#All]").RemoveDuplicates Columns:=Array(1, _
2, 3), header:=xlYes
'Delete Rows in table where CostSourceId is blank
Dim rngBlanks As Excel.Range
With Worksheets("DownSelctions").ListObjects("DownSelectTable")
On Error Resume Next
Set rngBlanks = Intersect(.DataBodyRange, .ListColumns("CostSourceId").Range).SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If Not rngBlanks Is Nothing Then
rngBlanks.Delete
End If
End With
'Delete Rows in table where DSRationale is blank
Dim rngBlankDS As Excel.Range
With Worksheets("DownSelctions").ListObjects("DownSelectTable")
On Error Resume Next
Set rngBlankDS = Intersect(.DataBodyRange, .ListColumns("DSRationale").Range).SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If Not rngBlankDS Is Nothing Then
rngBlankDS.Delete
End If
End With
End Sub