title: VBA Customize scrollbar with UserForm variables
body: <p>Being new to VBA, I'm trying to add a customized scrollbar to my sheet. By customized I mean I can decide the min value, max value and smallchange of the scrollbar using a Userform where I asked the wanted values. So far I've stored the values in public variables following : 
  <a href="http://i.stack.imgur.com/T3uP2.jpg" rel="nofollow">screen of the Userform</a></p>
  
  <pre><code>Option Explicit
  
  Public A As Integer
  Public B As Integer
  Public C As Integer
  
  
  Private Sub Valider_Click()
  
  If IsNumeric(TextBox1.Value) Then
      A = TextBox1.Value
      Unload Me
  Else
      MsgBox "Valeur mimimale incorrecte"
  End If
  
  If IsNumeric(TextBox2.Value) Then
      B = TextBox2.Value
      Unload Me
  Else
      MsgBox "Valeur maximale incorrecte"
  End If
  
  If IsNumeric(TextBox3.Value) Then
      C = TextBox3.Value
      Unload Me
  Else 
      MsgBox "Pas incorrect"
  End If
  
  MsgBox A &amp; " " &amp; B &amp; " " &amp; C
  
  End Sub
  </code></pre>
  
  <p>and I just reassigned the values for ".Min", ".Max" and ".SmallChange." with A,B and C in the defaut scrollbar code given by Excel :</p>
  
  <pre><code>Sub curseur()
  
  ActiveSheet.ScrollBars.Add(180, 45.75, 119.25, 13.5).Select
  With Selection
      .Value = 0
      .Min = A
      .Max = B
      .SmallChange = C
      .LargeChange = 10
      .LinkedCell = "$G$4"
      .Display3DShading = True
  End With
  Range("F4").Select
  ActiveCell.FormulaR1C1 = "=RC[1]/100"
  Range("G4").Select
  With Selection.Interior
      .Pattern = xlSolid
      .PatternColorIndex = xlAutomatic
      .ThemeColor = xlThemeColorDark1
      .TintAndShade = -0.149998474074526
      .PatternTintAndShade = 0
  End With
  With Selection.Font
      .ThemeColor = xlThemeColorDark1
      .TintAndShade = -0.149998474074526
  End With
  End Sub
  </code></pre>
  
  <p>So I have 3 textboxes and one Commandbutton ("Valider"). Basically my idea is to fulfill those 3 boxes with the forementionned values (min, max,...) and store them in public variables. For the moment I'm just running my code from the developper tab using F5.</p>
  
  <p>I'm first running the userform. Once the textboxes are fulfilled and the CommandButton pressed, the MessageBox returns the values contained in the variables A,B and C.
  Then I want to use those to "define" my scrollbar. When I press F5, The scrollbar is showing itself (see screenshot) but if I go to the properties all values are set to zero. Seems I'm not calling the variables A,B,C the right way : <a href="http://i.stack.imgur.com/D3C2t.jpg" rel="nofollow">scrollbar properties</a></p>
  
  <p>Thanks in advance for your help.</p>