ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Scroll bar increments select case? (https://www.excelbanter.com/excel-programming/355267-scroll-bar-increments-select-case.html)

JeffMelton

Scroll bar increments select case?
 
I'm trying to change the increments of a scrollbar using select case,
but I can't quite get it, I'm sure its not too tough. Anybody have any
advice?

Sub ScrollBar3_Scroll()


Select Case Range("AJ7").Value
Case 101 To 199
ScrollBar3.SmallChange = 1
Case 200 To 298
ScrollBar3.SmallChange = 2
Case 300 To 395
ScrollBar3.SmallChange = 5
Case 400 To 590
ScrollBar3.SmallChange = 10
Case 600 To 980
ScrollBar3.SmallChange = 20
End Select

End Sub


JeffMelton

Scroll bar increments select case?
 
I've tried changing the code to this, but now I'm getting error 400 I'm
not really sure what to do.

Sub ScrollBar1_Scroll()

Select Case Range("L10")
Case 101 To 199
ActiveSheet.OLEObjects("ScrollBar1").Object.SmallC hange = 1
Case 200 To 298
ActiveSheet.OLEObjects("ScrollBar1").Object.SmallC hange = 2
Case 300 To 395
ActiveSheet.OLEObjects("ScrollBar1").Object.SmallC hange = 5
Case 400 To 590
ActiveSheet.OLEObjects("ScrollBar1").Object.SmallC hange = 10
Case 600 To 980
ActiveSheet.OLEObjects("ScrollBar1").Object.SmallC hange = 20
End Select

End Sub


NickHK

Scroll bar increments select case?
 
Jeff,
I see this code in the _Scroll event.
This does not fire if you click on the end arrows to change the value.
Surprisingly the _Click event fires for this.
I'm not sure what you are trying to achieve, but I not sure resetting the
..SmallChance every time you scroll is a good idea.
You reset it when the value in AJ7 changes.

NickHK

"JeffMelton" wrote in message
oups.com...
I'm trying to change the increments of a scrollbar using select case,
but I can't quite get it, I'm sure its not too tough. Anybody have any
advice?

Sub ScrollBar3_Scroll()


Select Case Range("AJ7").Value
Case 101 To 199
ScrollBar3.SmallChange = 1
Case 200 To 298
ScrollBar3.SmallChange = 2
Case 300 To 395
ScrollBar3.SmallChange = 5
Case 400 To 590
ScrollBar3.SmallChange = 10
Case 600 To 980
ScrollBar3.SmallChange = 20
End Select

End Sub





All times are GMT +1. The time now is 12:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com