Share via

Slider control

Anonymous
2011-04-03T17:48:02+00:00

I have placed a slider control (from the ActiveX controls) on my worksheet and have linked the output to a cell.

This all works good but my problem is that I need to set the max value of the slider to either the value of cell A1  or the Max value of the range A9:A2000.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2011-04-03T18:11:32+00:00

You can't set the Max to a cell reference, so you have to use code:

Right-click the sheet tab.

Select View Code from the popup menu.

Copy the following code into the module:

Private Sub Worksheet_Change(ByVal Target As Range)

  If Not Intersect(Range("A9:A2000"), Target) Is Nothing Then

    Me.ScrollBar1.Max = Application.WorksheetFunction.Max(Range("A9:A2000"))

  End If

End Sub

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2011-04-03T19:31:18+00:00

    Thanks

    Was this answer helpful?

    0 comments No comments