Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range Selection
I have written code that results in a range of cells being selected in one
column. (Each time the code is run, it selects a different range of varying sizes, depending on what it is searching for). Once the range is selected, I would then like to offset that selection by 3 columns and select the same size range in that other column, plus the same size range in the column immediately to the right of that one. For example, let's say my code ends up selecting the range A10:A20. I then want my code to offset that selection to D10:E20. Does that make sense? Thanks for your help! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range Selection
why are you selecting in the first place. Tell us what you are trying to do
and we can suggest a better way. -- Don Guillett SalesAid Software "Steve C" wrote in message ... I have written code that results in a range of cells being selected in one column. (Each time the code is run, it selects a different range of varying sizes, depending on what it is searching for). Once the range is selected, I would then like to offset that selection by 3 columns and select the same size range in that other column, plus the same size range in the column immediately to the right of that one. For example, let's say my code ends up selecting the range A10:A20. I then want my code to offset that selection to D10:E20. Does that make sense? Thanks for your help! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range Selection
Hi,
Dim rg as range, rg2 as range set rg=range("A10:A20") 'If rg is a one-column single-area range set rg2 = Rg.Offset(0,3).Resize(Rg.cells.count, 2) -- Regards, Sébastien <http://www.ondemandanalysis.com "Steve C" wrote: I have written code that results in a range of cells being selected in one column. (Each time the code is run, it selects a different range of varying sizes, depending on what it is searching for). Once the range is selected, I would then like to offset that selection by 3 columns and select the same size range in that other column, plus the same size range in the column immediately to the right of that one. For example, let's say my code ends up selecting the range A10:A20. I then want my code to offset that selection to D10:E20. Does that make sense? Thanks for your help! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range Selection
Thanks, Sebastien. That does the trick!
"sebastienm" wrote: Hi, Dim rg as range, rg2 as range set rg=range("A10:A20") 'If rg is a one-column single-area range set rg2 = Rg.Offset(0,3).Resize(Rg.cells.count, 2) -- Regards, Sébastien <http://www.ondemandanalysis.com "Steve C" wrote: I have written code that results in a range of cells being selected in one column. (Each time the code is run, it selects a different range of varying sizes, depending on what it is searching for). Once the range is selected, I would then like to offset that selection by 3 columns and select the same size range in that other column, plus the same size range in the column immediately to the right of that one. For example, let's say my code ends up selecting the range A10:A20. I then want my code to offset that selection to D10:E20. Does that make sense? Thanks for your help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Narrow Range based on Selection in Another Range | Excel Discussion (Misc queries) | |||
Identifying a selection of a selection of a range | Excel Worksheet Functions | |||
Range selection | Excel Programming | |||
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. | Excel Programming | |||
Creating range name for a range selection | Excel Programming |