VBA-Hide entire row if cell in column is empty or blank (visually empty but has formula)

sdoppke

Well-known Member
Joined
Jun 10, 2010
Messages
647
Hi everyone, well actually the title said it all. I searched for this topic but cant find exactly this case.

So again, looking for script that hides entire row in if a any cell in column A is empty or blanck (has formula)

Thaks a bunch.

sd
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
You could use AutoFilter with the criteria "<>"

If it must use VBA, you could record a macro while you do that.
 
Upvote 0
Code:
Sub Macro1()
    Dim Lastrow As Long
    Lastrow = Range("A1").Find("*", , xlFormulas, , xlByRows, xlPrevious).Row
    Range("A1:A" & Lastrow).AutoFilter Field:=1, Criteria1:="<>"
End Sub
 
Upvote 0
Code:
Sub Macro1()
    Dim Lastrow As Long
    Lastrow = Range("A1").Find("*", , xlFormulas, , xlByRows, xlPrevious).Row
    Range("A1:A" & Lastrow).AutoFilter Field:=1, Criteria1:="<>"
End Sub


Thanks AlphFrog! im doing something wrong to where im getting an error:
"object variable or with variable not set"

Any ideas?

sd
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top