View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Wazooli Wazooli is offline
external usenet poster
 
Posts: 51
Default trouble with commandbarbutton.state

Can anyone tell me why the following code does not change the button state?
Sub component_EOP()

Dim comp_rng As Range
Dim comp_list_end As Long
Dim comp_con As CommandBarButton

Set comp_rng =
Workbooks("reports.xls").Worksheets("Components"). Range("d1:d65535")
Set comp_con = CommandBars("End of list").Controls("component_EOP")

comp_con.FaceId = 82

comp_list_end = Application.WorksheetFunction.CountA(comp_rng)

Workbooks("reports.xls").Worksheets("Components"). Activate

If ActiveWindow.ScrollRow = 1 Then
ActiveWindow.ScrollRow = comp_list_end - 10
comp_con.state = msoButtonDown
Else
ActiveWindow.ScrollRow = 1
comp_con.state = msoButtonUp
End If


End Sub