How to speed up hide columns

C

Colo[MVP Excel]

I'm using OWC Spreadsheet control on the userform of Excel and I'd like to
Hide unnecessary columns.
Now I'm using the following code but it takes time.
How can I speeding up this code.

UserForm1.Spreadsheet1.Range("H1:ZZZ1").EntireColumn.Hidden = True

Thanks,

Colo
 
W

Wei-Dong XU [MSFT]

Hi Colo,

"UserForm1.Spreadsheet1.Range("H1:ZZZ1").EntireColumn.Hidden = True"
This way, Spreadsheet will need to enumerate all the cells for setting the
property, which gives a slow response.

I'd suggest you can use the code below to set the ViewableRange property
for the viewable range which will be very prompt.
UserForm1.Spreadsheet1.ActiveWindow.ViewableRange = "A:G"

Please feel free to let me know if you have any question.

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Wei-Dong XU [MSFT]

Hi Colo,

It is my pleasure!

Have a nice weekend!

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top