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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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
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
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,214,377
Messages
6,119,185
Members
448,872
Latest member
lcaw

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