Macro Help

volkl77

Board Regular
Joined
Apr 5, 2008
Messages
76
Hi All. Is it possible to set up a macro to hide all the blank rows in a given area on all the tabs of a worksheet? If so any help would be greatly appreciated. Thanks!!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
You can record a macro doing Ctrl+G (Goto SPecial)-->Blanks-->Hide rows.

You could also try using a Data Filter and uncheck blanks from the list.

HTH,
 
Upvote 0
This works but will only allow me to do one sheet at a time.

Since all sheets are the exact same layout is it possible to set a range of rows (19 to 168) and if column "e" is blank it hides or deletes it?
 
Upvote 0
You can use a For...Each...Next construct:

Code:
Sub Foo()
Dim ws as worksheet
  For Each ws in Activeworkbook.Worksheets
     '  Your code here
  Next ws
end Sub
 
Upvote 0
i am testing this code to hide rows, but i keep getting an error saying "type mismatch", at the bolded text any ideas?

Sub Hide_Blanks()
'
' Hide_Blanks Macro
'

'
If Range("E19:E168").Value = "0" Then
Range("E19:E168").EntireRow.Hidden = True
End If

End Sub
 
Upvote 0
Well, you can't exactly evaluate a range that way, it's too broad a stoke to actually work.

If you want to check each cell in a column for a 0 value you'd have to loop (and lose the quotes around the 0), although Data Filter would be much easier.
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,839
Members
452,948
Latest member
UsmanAli786

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