HI, I am trying to insert form my code a scrollbar conected to a specific range. When doing it form Excel I only have to insert form the Vba toolbar the scrollbar, right clik and give, the properties I need to specify ( linkedcell, max, min) but when I do this from my code an error appears. Here is what i tried:
Sub Macro1(MyRange As Range)
Dim MyObject As OLEObject
ActiveSheet.OLEObjects.Add(ClassType:="Forms.ScrollBar.1").Select
Set MyObject = Selection
With MyObject
.LinkedCell = MyRange.Offset(, -1)
.Top = MyRange.Top
.Left = MyRange.Left
.Width = MyRange.Width
.Height = MyRange.Height
.Max = 100
.Min = 0
End With
End Sub
the problem is the linked cell doesnt link, the properties left, top , width and height do work but max and min don't work
Sub Macro1(MyRange As Range)
Dim MyObject As OLEObject
ActiveSheet.OLEObjects.Add(ClassType:="Forms.ScrollBar.1").Select
Set MyObject = Selection
With MyObject
.LinkedCell = MyRange.Offset(, -1)
.Top = MyRange.Top
.Left = MyRange.Left
.Width = MyRange.Width
.Height = MyRange.Height
.Max = 100
.Min = 0
End With
End Sub
the problem is the linked cell doesnt link, the properties left, top , width and height do work but max and min don't work