|
-
Mar 7th, 2006, 02:56 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Loop Tuning EXCEL
Hi,
What I want to do is to hide all row that are NOT bold or empty.
My range starts at row 12 and I don't know at witch row it finishes. I know that it finishes with the text GRAND TOTAL in column A and there is approx. 600 rows. I want this job to be performed when the button is clicked
So here is what I've done
VB Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
ActiveSheet.Range("A12").Activate
Do While (ActiveCell.Value <> "GRAND TOTAL")
If (ActiveCell.Font.Bold = False Or ActiveCell.Value = "") Then
ActiveCell.EntireRow.Hidden = True
End If
ActiveCell.Offset(1, 0).Activate
Loop
Application.ScreenUpdating = True
End Sub
This loop does all I want, but it takes 45 to 60 sec to accomplish. That is way too long.
Any idea?
-
Mar 7th, 2006, 03:16 PM
#2
Re: Loop Tuning EXCEL
Bill
Try turning calculation off before running the loop, then turn it back on.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Mar 7th, 2006, 03:27 PM
#3
Thread Starter
Addicted Member
Re: Loop Tuning EXCEL
humm, don't seem to speed it up
-
Mar 7th, 2006, 03:29 PM
#4
Re: Loop Tuning EXCEL
Humm, I just ran this on a sheet with 23752 rows and 21 columns and it ran in under 1 second. There must be something else going on with your sheet.
(This is a stab in the dark) - Do you have any conditional formatting on the sheet?
Or do you have a worksheet_change or _sectionchange event? If so then disable events when looping.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Mar 7th, 2006, 03:33 PM
#5
Thread Starter
Addicted Member
Re: Loop Tuning EXCEL
No, but your stab in the dark gived me an hint.
I've tried the magic tricks of rebooting and it runned under 3 seconds
Thanks again for your help!!!
Enjoy windows and magic reboot...
-
Mar 7th, 2006, 03:35 PM
#6
Re: [RESOLVED] Loop Tuning EXCEL
it really only worked because I posted here....
(oh the joys of MS...)
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|