Preface: I am learning VBA as I go over the last three weeks, so please explain any solutions like i'm a complete idot. Thank you so much in advance for any help.
Prefered:
I want to Delete an entire row based on a criteria in column D (Criteria:= "REMOVAL BLANKET")
Or
Acceptable:
I would Like to Delete all Visible Rows from a Flitered Selection of Colum D.
My Current code is:
See ISSUE 1: I need to get the entire row selected to delete. cant seem to scipt it right
Sub REMOVAL_BLANKET()
'
' REMOVAL_MACRO
'
' Keyboard Shortcut: Ctrl=g
'
Dim y As String
Dim X As Integer
Dim ba As String
Dim ba1 As Variant
Range("D2").Select
' Dimension variables.
y = ActiveCell ' Change this to True if you want to
X = 1 ' delete rows 1, 3, 5, and so on.
I = 1
xRng = X
' Loop once for every row in the selection.
ba = ActiveCell
ba1 = ba
For xCounter = I To 114
'ActiveCell.Offset(rowoffset:=1).Select
y = ActiveCell
' If Y is True, then...
If y <> "REMOVAL BLANKET" Then
I = I + 1
' ...delete an entire row of cells.
GoTo first
' Otherwise...
Else
ActiveCell.Offset(columnoffset:=-3).Select
Selection.End(xlToRight).Select
Range(ActiveCell, ActiveCell).Delete Shift:=xlToLeft <--- ISSUE 1
' ...increment I by one so we can cycle through range.
If ActiveCell = "Z" Then
y = ActiveCell
GoTo first
Else
If y = "Z" Then
Selection.End(xlToRight).Select
'Range(ActiveCell, ActiveCell.Offset(columnoffset:=-255)).Select
ActiveCell.Offset(Rowoffset:=1).Select
GoTo Third
End If
End If
End If
' If Y is True, make it False; if Y is False, make it True.
first:
Third:
ActiveCell.Offset(Rowoffset:=1).Select
Next
End Sub
Bookmarks