Thread: Cell click
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sandy Sandy is offline
external usenet poster
 
Posts: 355
Default Cell click

Hello
I would like to be able to click on cell A25 and hide any rows in 26-44 that
have an 1 in Col A. I can use this code to hide the rows using a button, but
I am not sure how to incorporate the click event to fire the mcaro.
My code :

rivate Sub CommandButton1_Click()

Application.ScreenUpdating = False
Dim I As Long
Dim Hidden As Boolean
For I = 26 To 44
If Rows(I).EntireRow.Hidden Then
Hidden = True
Rows(I).EntireRow.Hidden = False
End If
Next I
If Hidden Then Exit Sub
For I = 26 To 44 Step 1
If Cells(I, 1).Value = 1 Then
Range(Cells(I, 1), Cells(I, 1)).EntireRow.Hidden = True
End If
Next I

End Sub

Thanks for your help