title: VBA, coding a dynamic range (column) for sorting data
body: <p>I am a bit of a rookie in vba and I am stuck on something which should be relatively easy:
  I have a marco specifying the column number from the headers names:</p>
  
  <pre><code>Dim onomata As Integer
  'find column named Name of ship
  Set acell = rows(1).Find(What:="Name of ship", LookIn:=xlValues, _
  LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
  MatchCase:=False, SearchFormat:=False)
  
  If Not acell Is Nothing Then
      onomata = acell.Column
  End If
  </code></pre>
  
  <p>Now I want to sort my data based on this column:</p>
  
  <pre><code>Cells.Select
  ActiveWorkbook.ActiveSheet.Sort.SortFields.Clear
  ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key:=Range( *this is where I want to introduce the column* ), _
      SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
      xlSortTextAsNumbers
  With ActiveWorkbook.ActiveSheet.Sort
      .SetRange Range("A1:AR100000")
      .Header = xlYes
      .MatchCase = False
      .Orientation = xlTopToBottom
      .SortMethod = xlPinYin
      .Apply
  End With
  </code></pre>
  
  <p>However, my variable is integer while the command requests a range value. Can anyone help me in how to code it?</p>