Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Following procedures ------------------------------------------------------------- Private Sub ScrollBar1_Change() Range("A1").Value = ScrollBar1.Value End Sub ------------------------------------------------------------- Private Sub ScrollBar1_Scroll() Range("A1").Value = ScrollBar1.Value End Sub ------------------------------------------------------------- for ScrollBar1 (with parameters Min=0, Max=10) on sheet change values in cell A1 from 0 to 10 using step 1. How to write procedures that change in cell A1 value from 1,00 to 10,00 using step 0,01, but without indirect cell (like in example in John Walkenbach's book)? And second problem. When I set in cell A1 new value and click scrollbar arrow, value in cell changes from last 'remembered' by scrollbar value not from new value. How to resolve such problem? Best wishes Dan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
change the max to 900 and keep the min at zero, then use
Private Sub ScrollBar1_Change() Range("A1").Value = ScrollBar1.Value / 100 + 1 End Sub Don't use any other events. -- Regards, Tom Ogilvy " wrote: Hi, Following procedures ------------------------------------------------------------- Private Sub ScrollBar1_Change() Range("A1").Value = ScrollBar1.Value End Sub ------------------------------------------------------------- Private Sub ScrollBar1_Scroll() Range("A1").Value = ScrollBar1.Value End Sub ------------------------------------------------------------- for ScrollBar1 (with parameters Min=0, Max=10) on sheet change values in cell A1 from 0 to 10 using step 1. How to write procedures that change in cell A1 value from 1,00 to 10,00 using step 0,01, but without indirect cell (like in example in John Walkenbach's book)? And second problem. When I set in cell A1 new value and click scrollbar arrow, value in cell changes from last 'remembered' by scrollbar value not from new value. How to resolve such problem? Best wishes Dan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
'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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
thanks for help. How you certainly observed, I'm beginner in Excel object model, so some of my quastions are rather trivial. Regards Dan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sheet tabs & horizontal scrollbar disappeared - Excel 2003 | Excel Discussion (Misc queries) | |||
inserting scrollbar inside an Excel Sheet | Excel Discussion (Misc queries) | |||
scrollbar reslut makes another scrollbar to show | Excel Discussion (Misc queries) | |||
Unlock a spinner or scrollbar on a protected sheet | Excel Worksheet Functions | |||
Excel VBA - Userform Texbox/Scrollbar problem | Excel Programming |