Hide Rows with "" value?

Brigg

New Member
Joined
Apr 16, 2013
Messages
5
Column A has formulas that pull information from other tabs. So that it isn't cluttered up, I have it returning "" if the formula is FALSE. However, it does not seem to be recognizing the "" value. Is it even possible to do or should I be trying something else? Any help is much appreciated.

Thx!

Code:
Sub PostCondense()
Dim LastRow As Long
 Dim Rng As Range
 LastRow = Range("A38").End(xlUp).Row '
Set Rng = Range("A8:A" & LastRow) '
Application.ScreenUpdating = False
 For Each Cell In Rng
If Cell.Value = "" Then
Cell.EntireRow.Hidden = True
End If
Next Cell
Application.ScreenUpdating = True
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    ActiveSheet.EnableSelection = xlUnlockedCells
End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Brigg

New Member
Joined
Apr 16, 2013
Messages
5
ADVERTISEMENT
What else would cause this macro to not function? If I delete the formula and run the macro, it works. But it doesn't work when calculated this particular value. Why am I doing wrong?
 
Upvote 0

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Maybe Schedule!A28 contains a space, in which case that's what your formula will return. Does this formula work fo you?

=IF(ISNUMBER(Schedule!A28),Schedule!A28,"")
 
Upvote 0

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Perhaps this line isn't getting the correct last row #
LastRow = Range("A38").End(xlUp).Row

If column A is formulas, how far down are those formulas going?
If it's going beyond A38, then your lastrow variable will be 1, making rng A1:A8
This would explain why removing the formula resolves the issue.


Try this instead
LastRow = Cells(Rows.Count,"A").End(xlUp).Row
 
Upvote 0

Forum statistics

Threads
1,195,990
Messages
6,012,727
Members
441,723
Latest member
iansitorus

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
Top