ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adjust a Scroll bar to fill in a range perfectly (https://www.excelbanter.com/excel-programming/295477-adjust-scroll-bar-fill-range-perfectly.html)

[email protected]

Adjust a Scroll bar to fill in a range perfectly
 
Hi!!!
Sorry because I do not know the english name.
if you go to view/toolbox. there are many different controls. one of
then is similar to the ScrollBar located in ActiveX controls, "I
don't know the name anyway" my question is:"


How can Adjust this "ControlBox" to fill in a range "say
Range("C3:F3") perfectly.

My problem comes because the Scrollbox in ActiveX controls has a
property to change the resize the control size with the cells, but the
"ScrollBox from the Toolbox, again this is not a ScrollBox, but looks
similar, and I don't know the Englixh name, does not have this
property enabled.

So I need to use VBA to adjust this "ScrollBox to a Range.

The Same way, if I get a Shape and or one Image, how can Adjust this
images size to fill perfectly in a Range, useful if I want to adjust
my company's logotipe in a Range, some Logotipes are to big others so
small, I would like to create a Template, with a botton to get the
image from a File and once is teken "Already done", adjust it to the
range named Company_logotipe.

This is the same question but for a Shape and/or image!


Many Thanks!!!

Bill Renaud[_2_]

Adjust a Scroll bar to fill in a range perfectly
 
Public Sub SetScrollBar()
Dim ws As Worksheet
Dim rng As Range
Dim sb1 As OLEObject

Set ws = ActiveSheet
Set rng = ws.Range("$C$3:$F$3")
Set sb1 = ws.OLEObjects("ScrollBar1")

With sb1
'Set the upper-left corner of the scroll bar to the range.
.Top = rng.Top
.Left = rng.Left

'Now set the height and width of the scroll bar.
.Height = rng.Height
.Width = rng.Width
End With
End Sub

--
Regards,
Bill


wrote in message
m...
Hi!!!
Sorry because I do not know the english name.
if you go to view/toolbox. there are many different controls. one of
then is similar to the ScrollBar located in ActiveX controls, "I
don't know the name anyway" my question is:"


How can Adjust this "ControlBox" to fill in a range "say
Range("C3:F3") perfectly.

My problem comes because the Scrollbox in ActiveX controls has a
property to change the resize the control size with the cells, but the
"ScrollBox from the Toolbox, again this is not a ScrollBox, but looks
similar, and I don't know the Englixh name, does not have this
property enabled.

So I need to use VBA to adjust this "ScrollBox to a Range.

The Same way, if I get a Shape and or one Image, how can Adjust this
images size to fill perfectly in a Range, useful if I want to adjust
my company's logotipe in a Range, some Logotipes are to big others so
small, I would like to create a Template, with a botton to get the
image from a File and once is teken "Already done", adjust it to the
range named Company_logotipe.

This is the same question but for a Shape and/or image!


Many Thanks!!!





All times are GMT +1. The time now is 05:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com