Hello!
I have recorded a macro that will delete all rows if data in Column "A1" is blank. However, I want the macro to identify which rows to delete by Column Name instead of "A1". If the Column name doesn't exist than the code should do nothing.
This is my current code:
Sub GetX()
Application.ScreenUpdating = True
[a:a].AutoFilter Field:=1, Criteria1:="="
[a2:a65536].SpecialCells(xlVisible).EntireRow.Delete
If [a1] = "" Then [1:1].Delete
ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
Display More
This is an example of what I want it to do:
[TABLE="width: 263"]
HMO/POS(A1)
Number (A2)
OWNER
Color
AAA
[TD="align: right"]11
[/TD]
ABC, FF
RED
CCC
[TD="align: right"]37
[/TD]
RED
[TD="align: right"]45
[/TD]
ASD
YELLOW
[TD="align: right"]23
[/TD]
DDD
[TD="align: right"]34
[/TD]
ZZZ
BLUE
FFF
[TD="align: right"]23
[/TD]
YELLOW
[TD="align: right"]67
[/TD]
GGG
[TD="align: right"]43
[/TD]
GGG
RED
Output:
HMO/POS (A1)
Number (A2)
OWNER
Color
AAA
[TD="align: right"]11
[/TD]
ABC, FF
RED
CCC
[TD="align: right"]37
[/TD]
RED
DDD
[TD="align: right"]34
[/TD]
ZZZ
BLUE
FFF
[TD="align: right"]23
[/TD]
YELLOW
GGG
[TD="align: right"]43
[/TD]
GGG
RED
[/TABLE]
Although the current code works, it takes "A1" instead of the column name "HMO/POS". Any help on this would be appreciated.