How can i hide unused rows with a macro

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

I have A sheet call invoice

In it i type my invoices but i want to hide unused rows but so the pdf looks nice,

So heres what i need,

A way to hide unused rows but leaving space if the unused part is smaller than sheet

So think of it this way,

The area I need to hide is between AC71 and AC233 (i want the row hidden but this is the columns that wil be used or empty.

Now my Page sizes are this
Page 1 AC50:AC110
Page 2 AC110:AC170
Page 3 AC171:AC250 (i might need to play around with these sizes)

So what i want is this

If Used area of range AC71 and AC233 is less than AC71:AC110 then hide AC111:AC233

If Used area of range AC71 and AC233 is less than AC71:AC170 but more than AC110 then hide AC171:AC233

else unhide all

any ideas how something like this could be done?

Thanks

Tony
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,214,823
Messages
6,121,777
Members
449,049
Latest member
greyangel23

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