hide rows or columns

vra

Board Regular
Joined
Apr 16, 2011
Messages
95
Office Version
  1. 2019
Platform
  1. Windows
  2. MacOS
After filling figures in a table how to hide a row/ column having 0 in a paricular column having a particular heading .. what command or program so that in every worksheet or file it can be used , to avoid it doing manually.Kindly suggest ?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Thanks alot for this. I shall try & get back to u.

Thanks indeed!!
 
Upvote 0
Actually i want two buttons on sheet : HIDE & UNHIDE ,
which will hide the particular rows ,when range of cells in that row are 0 or blank.
i created button but what code to write & hoe those buttons will work. whether macro will be needed?? etc.etc.
 
Upvote 0
Hi,

Did you check out the link I gave you?
Did it offer a solution to your problem?
Which Column will contain the 0/blank cells?
What is the range of your data?

Assuming that the link provides you with your answer and that you know how to change the range so that it suits your sheet, try this....

Press alt-F11 to access VBA.
Click Insert-Module.
Paste the code from the link I gave you into the white space on the right.
Paste the code a second time into the same area and change the Sub HideRows () to Sub UnHideRows ().

Change this line in Sub UnHideRows ()....

.Rows(i).EntireRow.Hidden = True

To this....

.Rows(i).EntireRow.Hidden = False

Press alt-Q to go back to your worksheet.

Right click on your Hide button and click Assign Macro, select HideRows from the box, click OK.

Right click on your UnHide button and click Assign Macro, select UnHideRows from the box, click OK.

I hope this helps.

Ak
 
Upvote 0
Thanks for such a quick reply.On right click no option for assigning macro. M using excel 2007. I want to hide unused rows & columns & then print what is visible on screen. is it possible & how??
 
Upvote 0
Hey,

How is your workbook saved?
As XLSX, XLSM or 2002-2007 compatible?
If it is saved as XLSX you need to save it as XLSM or 2002-2007 compatible.
You will then be able to assign your macros to the buttons.

You may want to start a new thread for your VBA Print Dynamic Range code

Ak
 
Upvote 0
i saved as xlsm still on right click no option of assigning macro.
& i do not have option of 2002-2007 compatible, instead i have option of saving as excel 93-2003 workbook.
Secondly can i move this sheet to 2003 excel files?
 
Upvote 0
Hi,

My mistake that should be 93-2003 compatible.
What did you use to create your button?
I have used a shape and a form control and when I right click the button I get the Assign Macro option.

Ak
 
Upvote 0
I M REALLY VERY THANKFUL TO TOU!!
I HAVE DONE WITH ONE CHART.
NEXT CHART I HAVE TO HIDE ROWS & COLUMNS BOTH. WILL TRY WITH SAME CODE & THEN GET BACK TO YOU.
VERY KIND OF YOU!! REPLIES ARE VERY QUICK.
FIRST I CREATED BUTTON BY CONTROL TOOL BOX ,, nOW I CREATED AS U SAID.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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