speeding up macro


Posted by CM on February 04, 2002 4:49 PM

I have this macro written that activates when the sheet is activated but it is slow. As soon as the initial hiding of data it then asks for a password. My problem is that when I click to activate the sheet, for a split second I can the data before it is hidden. I would like for this data to be hidden before the sheet is activated and then appear after the password is put in. I have tried to put the hidedata code in the sheet2.deactive part but that didn't work. I have also tried to put the code into the deactivate part of sheet1 so that it will hide the data on sheet 2 when sheet 1 is deactivated. I guess, I want the data to be hidden while sheet 2 is not active. I have sheet 2 set up so that after it is activated it will ask for a password and display the data when the correct password is entered. But like I said, for that split second before it asks for a password I can see the data as it is being hidden.
I have also put application.screenupdating = false befor the excution of the hiding code but that caused it to not hide the data.

Any ideas?



Posted by Ivan F Moala on February 04, 2002 11:23 PM


How are you hiding the data ??

One quick way to hid is;

Private Sub Worksheet_Activate()
Dim Pw As String
Cells.EntireRow.Hidden = True
Pw = InputBox("Enter password")
If Pw = "test" Then Cells.EntireRow.Hidden = False: End
Sheet1.Activate
End Sub

see if this is any better otherwise repost...
there are many ways to skin a cat.


Ivan