ScrollBar Sheet problem
'this line must be at the top of the module
Public bBlockEvents As Boolean
Private Sub ScrollBar1_Change()
If bBlockEvents Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Range("A1").Value = ScrollBar1.Value / 100 + 1
ErrHandler:
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal target As Range)
On Error GoTo ErrHandler
If target.Address = "$A$1" Then
Select Case target.Value
Case 1 To 10
bBlockEvents = True
ScrollBar1.Value = (Range("A1").Value - 1) * 100
Case Else
Application.EnableEvents = False
target.Value = ScrollBar1.Value / 100 + 1
End Select
End If
ErrHandler:
bBlockEvents = False
Application.EnableEvents = True
End Sub
If some events stop working it is probably because application.EnableEvents
has remained set to false or bBlockEvents has been set to True. If you can't
fix them any other way, close and reopen Excel. I wouldn't expect this to
happen unless you are altering/editing and testing code.
--
Regards,
Tom Ogilvy
" wrote:
Tom,
Great thanks. There is still problem when I set value to the cell and
push arrow, scrollbar start from old remebered one.
Regards
Dan
|