Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How can I add scrollbar to a number of cells

Hi,

How can I make a scrollbar control a number of cells in a worksheet. I
want Cells A45: A105 to be controlled via the control box scrollbar
which I just placed on my worksheet. Could anyone please help me with
how I could do that.

Thank You. All help is appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default How can I add scrollbar to a number of cells


'Use a SpinButton instead of a ScrollBar.
'Set the SpinButton Max value to a large number.
'Set the SpinButton Min value to a large negative number.
'Adjust names in code as necessary.
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

'Place this code in the worksheet module...
Private Sub SpinButton1_SpinDown()
Call LooksLikeScrollDown
End Sub
'--
Private Sub SpinButton1_SpinUp()
Call LooksLikeScrollUp
End Sub
'----------

'Place this code in a standard module...
Sub LooksLikeScrollUp()
'Jim Cone - San Francisco - April 2007
Dim rng As Excel.Range
Dim vFirst As Variant
Dim lngCnt As Long

Set rng = Range("A45:A105")
lngCnt = rng.Count
vFirst = rng(1).Value

rng.Resize(lngCnt - 1, 1).Value = rng.Offset(1, 0).Resize(lngCnt - 1, 1).Value
rng(lngCnt).Value = vFirst
Set rng = Nothing
End Sub
'--
Sub LooksLikeScrollDown()
Dim rng As Excel.Range
Dim vLast As Variant
Dim lngCnt As Long

Set rng = Range("A45:A105")
lngCnt = rng.Count
vLast = rng(lngCnt).Value

Range(rng(2), rng(lngCnt)).Value = rng.Resize(lngCnt - 1, 1).Value
rng(1).Value = vLast
Set rng = Nothing
End Sub
'----------






wrote in message
Hi,
How can I make a scrollbar control a number of cells in a worksheet. I
want Cells A45: A105 to be controlled via the control box scrollbar
which I just placed on my worksheet. Could anyone please help me with
how I could do that.
Thank You. All help is appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default How can I add scrollbar to a number of cells

Assumed is that the scrollbar is named "ScrollBar1". In the worksheet's code
module paste this:

Private Sub ScrollBar1_Change()
Range("A45:A105").Value = ScrollBar1.Value
End Sub

To access the worksheet's code module, right click the worksheet tab and
select View Code. Then paste the above.

Regards,
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
Finding Number Within Range Then Copying Data Below Number to Cells [email protected] Excel Programming 5 October 16th 06 06:32 PM
Count number of times a specific number is displayed in cells subs[_2_] Excel Programming 1 June 27th 05 03:15 PM
scrollbar reslut makes another scrollbar to show Patrik Excel Discussion (Misc queries) 0 April 18th 05 03:11 PM
excel format cells/Number/Category: Number problem Matts Excel Discussion (Misc queries) 5 December 9th 04 09:47 PM
Scrollbar stewatr Excel Programming 0 November 28th 03 04:57 PM


All times are GMT +1. The time now is 06:45 AM.

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"