Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Linking multiple scrollbars based on value

Hi,

I am developing a questionare in excel, and require the users to select an
answer based on a scroll bar, ranging from 1 -100. I have 5 questions, each
with its own scrollbar, which in total need to add up to 100.

Is it possible with VB to enable the scroll bars to automatically adjust so
that when one is changed, the others change accordingly.

Any assistance would be greatly appreciated.

Scott
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Linking multiple scrollbars based on value


Hi

1st try to use the scroll bar from Control Toolbox rather than Form toolbar,
because it provide more flexibility for programming. After dragging the
first and 2nd toolbars then right-click it view code, you will see the it
event sub of Scrollbar1_change()

if you want the scrollbar 2 change the same value as scrhollbar 1 change, so
add below code:

Me.ScrollBar2.value = scrollbar1.value

So everytime you change scrollbar1 then scrollbar 2 will change accordingly.

hope this help.

Leung



"Scott from Gippsland" wrote:

Hi,

I am developing a questionare in excel, and require the users to select an
answer based on a scroll bar, ranging from 1 -100. I have 5 questions, each
with its own scrollbar, which in total need to add up to 100.

Is it possible with VB to enable the scroll bars to automatically adjust so
that when one is changed, the others change accordingly.

Any assistance would be greatly appreciated.

Scott

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Linking multiple scrollbars based on value

Thanks, this helps in part.

I now need the VB code to go further so that when a scrollbar is modified,
the other change so that the total of all scrollbars is 100.

For example:
If i make scrollbar1 = 40, then scrollbars 2, 3, 4, and 5 need to
automatically recalculate so that each equals 15, making the total of all the
scrollbards equal to 100.

"Leung" wrote:


Hi

1st try to use the scroll bar from Control Toolbox rather than Form toolbar,
because it provide more flexibility for programming. After dragging the
first and 2nd toolbars then right-click it view code, you will see the it
event sub of Scrollbar1_change()

if you want the scrollbar 2 change the same value as scrhollbar 1 change, so
add below code:

Me.ScrollBar2.value = scrollbar1.value

So everytime you change scrollbar1 then scrollbar 2 will change accordingly.

hope this help.

Leung



"Scott from Gippsland" wrote:

Hi,

I am developing a questionare in excel, and require the users to select an
answer based on a scroll bar, ranging from 1 -100. I have 5 questions, each
with its own scrollbar, which in total need to add up to 100.

Is it possible with VB to enable the scroll bars to automatically adjust so
that when one is changed, the others change accordingly.

Any assistance would be greatly appreciated.

Scott

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Linking multiple scrollbars based on value

Hi

i think _Scroll method is better than _Change method because it won't be
fired when value changed.


Private Sub ScrollBar1_Scroll()
Dim intScore As Integer
intScore = (100 - ScrollBar1.Value) / 4
ScrollBar2.Value = intScore
ScrollBar3.Value = intScore
ScrollBar4.Value = intScore
ScrollBar5.Value = intScore
End Sub

Private Sub ScrollBar2_Scroll()
Dim intScore As Integer
intScore = (100 - ScrollBar2.Value) / 4
ScrollBar1.Value = intScore
ScrollBar3.Value = intScore
ScrollBar4.Value = intScore
ScrollBar5.Value = intScore
End Sub
Private Sub ScrollBar3_Scroll()
Dim intScore As Integer
intScore = (100 - ScrollBar3.Value) / 4
ScrollBar1.Value = intScore
ScrollBar2.Value = intScore
ScrollBar4.Value = intScore
ScrollBar5.Value = intScore
End Sub
Private Sub ScrollBar4_Scroll()
Dim intScore As Integer
intScore = (100 - ScrollBar4.Value) / 4
ScrollBar1.Value = intScore
ScrollBar2.Value = intScore
ScrollBar3.Value = intScore
ScrollBar5.Value = intScore
End Sub
Private Sub ScrollBar5_Scroll()
Dim intScore As Integer
intScore = (100 - ScrollBar5.Value) / 4
ScrollBar1.Locked = True
ScrollBar1.Value = intScore
ScrollBar2.Value = intScore
ScrollBar3.Value = intScore
ScrollBar4.Value = intScore
End Sub

this should work.



"Scott from Gippsland" wrote:

Thanks, this helps in part.

I now need the VB code to go further so that when a scrollbar is modified,
the other change so that the total of all scrollbars is 100.

For example:
If i make scrollbar1 = 40, then scrollbars 2, 3, 4, and 5 need to
automatically recalculate so that each equals 15, making the total of all the
scrollbards equal to 100.

"Leung" wrote:


Hi

1st try to use the scroll bar from Control Toolbox rather than Form toolbar,
because it provide more flexibility for programming. After dragging the
first and 2nd toolbars then right-click it view code, you will see the it
event sub of Scrollbar1_change()

if you want the scrollbar 2 change the same value as scrhollbar 1 change, so
add below code:

Me.ScrollBar2.value = scrollbar1.value

So everytime you change scrollbar1 then scrollbar 2 will change accordingly.

hope this help.

Leung



"Scott from Gippsland" wrote:

Hi,

I am developing a questionare in excel, and require the users to select an
answer based on a scroll bar, ranging from 1 -100. I have 5 questions, each
with its own scrollbar, which in total need to add up to 100.

Is it possible with VB to enable the scroll bars to automatically adjust so
that when one is changed, the others change accordingly.

Any assistance would be greatly appreciated.

Scott

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking Data based on criteria Wendy Excel Discussion (Misc queries) 0 January 29th 08 02:42 PM
Scrollbars [email protected] Excel Programming 0 January 19th 07 09:17 PM
linking multiple columns onto multiple worksheets talderman Excel Discussion (Misc queries) 3 August 23rd 06 02:00 AM
Multiple scrollbars Mark Excel Programming 2 July 18th 06 07:51 PM
Linking Information in Sheets based on its content Laura Excel Worksheet Functions 1 November 30th 05 03:52 PM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"