![]() |
variable replacement help please
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 |
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 |
variable replacement help please
i think i missed a couple quotes
Key1:=Worksheets("Rankings").Range("" & sColumn & "") should work "Gixxer_J_97" wrote: 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 |
variable replacement help please
that seems to work, thanks a lot. i was trying all different combinations of
double quotes and couldn't get it to work. i also tried the ampersand, but not how you have it in your combo. thanks again -- Gary "Gixxer_J_97" wrote in message ... i think i missed a couple quotes Key1:=Worksheets("Rankings").Range("" & sColumn & "") should work "Gixxer_J_97" wrote: 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 |
All times are GMT +1. The time now is 04:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com