LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Command Button / Macro won't execute properly

Newbie problem :)

In a particular worksheet I added a Command Button to execute the macro
below. When I click on the button the Excel "hour glass" appears and then
everything just "hangs", like it's in a loop or something.

If I execute the Macro below using Debug mode or just "Macro Run" from the
Excel toolbar it seems to work just fine.

I'm sure I'm doing something wrong that's very basic but being a newbie to
this stuff I don't know what it could be (I changed the row values while I'm
trying to figure out why it isn't working)?


Sub CommandButton1_Click()

'Turn screen updating and autocalculation off so it doesn't refresh for
every time a row is hidden
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False

'Perform loop starting in row 1004 and working "backwards" to row 7, one row
'at a time. For each row, if the value in the cell in column CK is 0, then
'hide the row.
For i = 30 To 7 Step -1
If Cells(i, "ck") = 0 Then Rows(i).Hidden = True
Next i

'Turn screen updating and autocalculation back on for normal operations
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command button code does not execute [email protected] Excel Programming 2 June 3rd 07 06:49 PM
Macro won't execute from a Command Button Dick Scheibe[_2_] Excel Programming 8 August 21st 05 12:16 AM
How do I execute command from button or hyperlink? rerhart Excel Discussion (Misc queries) 1 February 18th 05 09:41 PM
Command button - won't execute twice in sequence L Mehl Excel Programming 6 October 15th 04 07:45 PM
Programming command button to execute on a different worksheet Ed[_21_] Excel Programming 4 July 29th 04 12:17 AM


All times are GMT +1. The time now is 01:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"