![]() |
Multiple Col. Selection
Need a good way to select multiple columns using variables?
x=1 'column a y=3 'column c I would like to select column x and y but not column b? David |
Multiple Col. Selection
David
x=1 : y=3 : union(columns(x),columns(y)).Select Regards Trevor "David Fixemer" wrote in message ... Need a good way to select multiple columns using variables? x=1 'column a y=3 'column c I would like to select column x and y but not column b? David |
Multiple Col. Selection
Hi David,
Range(Cells(1, x), Cells(1, y)).EntireColumn.Select is one way -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "David Fixemer" wrote in message ... Need a good way to select multiple columns using variables? x=1 'column a y=3 'column c I would like to select column x and y but not column b? David |
Multiple Col. Selection
Hi
one way: try .... dim rng_1 as range dim rng_2 as range set rng_1 = cells(1,x).entirecolumn set rng_2 = cells(1,y).entirecolumn .... -- Regards Frank Kabel Frankfurt, Germany David Fixemer wrote: Need a good way to select multiple columns using variables? x=1 'column a y=3 'column c I would like to select column x and y but not column b? David |
Multiple Col. Selection
Bob,
I believe your method gets 1, 2, and 3? David |
Multiple Col. Selection
Was it tested before posting? It selects Columns A, B and C.
Alan Beban Bob Phillips wrote: Hi David, Range(Cells(1, x), Cells(1, y)).EntireColumn.Select is one way |
Multiple Col. Selection
David,
Yes it does, I missed the bit about column b. An adaptation of the method (not necessarily the best way) is Range(Cells(1, x).Address & "," & Cells(1, y).Address).EntireColumn.Select -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "David Fixemer" wrote in message ... Bob, I believe your method gets 1, 2, and 3? David |
All times are GMT +1. The time now is 03:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com