Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Finding Number Within Range Then Copying Data Below Number to Cells | Excel Programming | |||
Count number of times a specific number is displayed in cells | Excel Programming | |||
scrollbar reslut makes another scrollbar to show | Excel Discussion (Misc queries) | |||
excel format cells/Number/Category: Number problem | Excel Discussion (Misc queries) | |||
Scrollbar | Excel Programming |