ProX
ProX

Reputation: 297

How to set scrollbar value property in VBA

I do have a scrollbar and an input field (tempBuiten). I like the scrollbar to follow the value in the input field. So if a user set a value in that field, I would like the scrollbar to move to that position.

This is what I have so far:

Private Sub Worksheet_Change(ByVal Target As Range)

    Dim ws1 As Worksheet
    Set ws1 = Sheets(1)

    If Not Intersect(Range("tempBuiten"), Target) Is Nothing Then
       ' I use 10 as an test value for now
       ws1.ScrollBarBuiten.Value = 10
    End If

End Sub

I get: method or data member not found.

I am not sure if this is possible and how to do it if it is?

enter image description here

Upvotes: 1

Views: 11397

Answers (1)

ProX
ProX

Reputation: 297

To set the scrollbars current value, I did find this sollution:

ws1.Shapes("ScrollBarBuiten").ControlFormat.Value = 10

Upvotes: 3

Related Questions