Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Linking Scrollbar Min and Max values to worksheet cells

I'm not too familiar with controls, so I hope that what I'm trying to do is
easy.

I've placed a scrollbar control on my worksheet. There are MIN and MAX
values that can be manually entered in the properties page, but I need to
reference a worksheet cell for each of these parameters. Is there an easy
way to do this?

Thanks,
Greg
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default Linking Scrollbar Min and Max values to worksheet cells

I am not a Controls expert, but try the following code:
I used cell $A$1 for the minimum value of the scrollbar, and cell $A$2 for
the maximum value. I left the scrollbar named as "ScrollBar1". You might
need to add some code inside of each If statement to check the values for
proper range before assigning them to the ScrollBar.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngScrollMin As Range 'Cell that contains Scrollbar minimum.
Dim rngScrollMax As Range 'Cell that contains Scrollbar maximum.

Set rngScrollMin = Range("A1")
Set rngScrollMax = Range("A2")

If Target.Cells.Count 1 Then Exit Sub

If Not Intersect(Target, rngScrollMin) Is Nothing _
Then
'Changed cell is the cell containing the ScrollBar minimum.
ScrollBar1.Min = CLng(rngScrollMin.Value)
Exit Sub
End If

If Not Intersect(Target, rngScrollMax) Is Nothing _
Then
'Changed cell is the cell containing the ScrollBar maximum.
ScrollBar1.Max = CLng(rngScrollMax.Value)
Exit Sub
End If
End Sub

--
Regards,
Bill Renaud


"greg235" wrote in message
...
I'm not too familiar with controls, so I hope that what I'm trying to do

is
easy.

I've placed a scrollbar control on my worksheet. There are MIN and MAX
values that can be manually entered in the properties page, but I need to
reference a worksheet cell for each of these parameters. Is there an easy
way to do this?

Thanks,
Greg



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 axes scale values to cells Gene[_3_] Charts and Charting in Excel 1 August 17th 07 08:59 AM
Linking worksheet tab 2, 3, 4 ... names to cells in worksheet 1 northside104 Excel Programming 1 February 7th 07 03:02 AM
ScrollBar Linking/Synching. Rawce Excel Programming 4 November 20th 06 02:06 PM
Linking cells: open source to update values zimon72 Excel Discussion (Misc queries) 2 January 19th 06 07:21 AM
Linking changing values (cells) between worksheets. Tumbleweed Excel Worksheet Functions 2 August 18th 05 04:29 AM


All times are GMT +1. The time now is 12:11 PM.

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

About Us

"It's about Microsoft Excel"