Hiding rows that are not in print area

JamieDuncan

Board Regular
Joined
Aug 23, 2006
Messages
132
Is it possible to hide rows that are not in the print area?

There are 2 seperate selections of print area which have a large gap of sometimes unused rows, is there a way to hide them for not being in the print area?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
select the columns you want to hide and hide them using the right mouse button, alternatively, try creating the 2 print areas seperately using the ctrl key, tthis may help.

if not, re post and someone better will help.

Mark
 
Upvote 0
Try something like this:

Code:
Sub hide_outside_print_area()
Dim my_cell As Range
For Each my_cell In Range("A1:A30")
If Intersect(my_cell, Range("print_area")) Is Nothing Then my_cell.EntireRow.Hidden = True
Next my_cell
End Sub
 
Upvote 0
this works but....

its still running.

the range im covering is a1:eek:583 and it is taking approx 3 seconds PER ROW to run this macro, so far its only upto 225 :devilish: oh well...

oops... i set the range to a1:eek:583 instead of a1:a583 much quicker but still takes a long time to run macro, is there a quicker way or should i create a loading screen?
 
Upvote 0
ok i have it working twice in under a minute (once to unhide ie reset sheet and again to hide after print area adjusted)

which is perfectly acceptable for what i need, thanks oaktree

any ideas how to make it faster would be cool tho. :devilish:
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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