View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
drumsab drumsab is offline
external usenet poster
 
Posts: 4
Default Command Button / Macro won't execute properly

I made the suggested changes and am still experiencing the "hang".

I'm running Microsoft Excel 2003(11.8146.8132) SP2 if that makes a difference?

The code I tried again was:

Private Sub CommandButton1_Click()
Dim i As Long

Range("a1").Select

On Error GoTo errorhandler

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


'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

errorhandler:

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

End Sub








" wrote:

I am having office 2000 and i copied and pasted your code in my module
under "Sub Button1_Click()"

It is working fine.

Rgds,
Kannan