View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gixxer_J_97[_2_] Gixxer_J_97[_2_] is offline
external usenet poster
 
Posts: 206
Default variable replacement help please

Hi Gary,

i haven't tried it but maybe
Key1:=Worksheets("Rankings").Range(" & sColumn & ")

"Gary Keramidas" wrote:

i am trying to replace a cell reference with a variable and cannot seem to
figure it out.

here's specifically what i'm trying to accomplish

i have a dropdown with 4 selections, let's say the user selects totals

i set a variable, sColumn to Q4 if that cell contains "totals", so sColumn =
Q4

then when i sort using this formula,
Worksheets("Sheet1").Range("B5:Q18").Sort _
Key1:=Worksheets("Rankings").Range("XX")

how do i get the value from sColumn to where the "XX's are? (the
placeholders for this email)

thanks for any help
--


Gary