MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Hide unwanted rows and and Columns

Posted by Abhijeet on July 30, 2001 5:51 AM

I want to hide unwanted empty Rows and columns thru VBA. The following code is taking considerable time. If i do it manually from Excel it doesn't take much time. How??

The code is:
Application.ScreenUpdating = False
Selection.EntireColumn.Hidden = True
Selection.EntireRow.Hidden = True
Application.ScreenUpdating = True

Posted by mseyf on July 30, 2001 10:40 AM

have you tried simplifing your macro to something like:

Range("o1:iv1").EntireColumn.Hidden = True
Range("A275:A5000").EntireRow.Hidden = True

or you might try turning the automatic recalc off before hiding and back on after hiding

Application.Calculation = xlManual or xlAutomatic



Posted by Abhijeet on August 03, 2001 7:23 AM

Dear Mark,

Thank You very Much for your help.
Sorry to say that after trying that also Excel is taking too much time. Actually I am showing excel sheet on Visual Basic's Form using OLE container and I need to delete unwanted rows and columns before creating link ( I am using CerateEmbed).
I have to delete rest all rows..

Please help me...