title: Asking for vba codes in switching two dynamic ranges in one combobox
body: <p>Dears,</p>
  <p>I am looking for vba codes in switching two dynamic ranges in one combobox, i set one range under column A (e.g. 1,2,3,4,5) and another range under column D(a,b,c,d,e).  And there are two command button (&quot;letter&quot; and &quot;number&quot;) and one combobox. When i click the &quot;letter&quot; button, the range of the combobox will be letter; when i click the &quot;number&quot; button, the range of the combobox will be number. My codes are below:</p>
  <pre><code>Private Sub Cmd_letter_Click()
  Dim x As String
  x = &quot;d1&quot;
  numberorletter.Clear
  Call numberorletterprocedure
  End Sub
  
  Private Sub Cmd_number_Click()
  Dim x As String
  x = &quot;a1&quot;
  numberorletter.Clear
  Call numberorletterprocedure
  End Sub
  
  Private Sub numberorletterprocedure()
  Dim x As String
  Dim numberorletter As Range
  Dim ws As Worksheet
  Set ws = sheet1
  Set numberorletter.List = sheet1.Range(x, sheet1.Range(x).End(xlDown)).Value
  End Sub
  </code></pre>
  <p>However, it don't work, could you let me know which part i made the mistakes?  And how it will look like if it is done by create a function, not procedure?  Thanks!</p>