PC Review


Reply
Thread Tools Rate Thread

How can I add scrollbar to a number of cells

 
 
rachitm@gmail.com
Guest
Posts: n/a
 
      7th Apr 2007
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.

 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      8th Apr 2007

'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
'----------





<(E-Mail Removed)>
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.

 
Reply With Quote
 
=?Utf-8?B?R3JlZyBXaWxzb24=?=
Guest
Posts: n/a
 
      8th Apr 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel ScrollBar - Don't Move or Size with Cells ... tkt_tang@hotmail.com Microsoft Excel Programming 2 30th Jan 2008 02:21 AM
Linking Scrollbar Min and Max values to worksheet cells =?Utf-8?B?Z3JlZzIzNQ==?= Microsoft Excel Programming 1 1st Aug 2007 02:40 AM
Changing right side scrollbar bar row number box? news.microsoft.com Microsoft Excel Misc 7 6th Feb 2004 08:21 AM
Arrow Keys Move Scrollbar instead of cells. Louis Erickson Microsoft Excel Misc 2 8th Nov 2003 05:15 PM
Re: Arrow Keys Move Scrollbar instead of cells. Ron de Bruin Microsoft Excel Misc 0 3rd Oct 2003 11:07 PM


Features
 

Advertising
 

Newsgroups
 


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