Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Multiple Col. Selection

Bob,

I believe your method gets 1, 2, and 3?

David


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default 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


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple selection AND Excel Discussion (Misc queries) 9 February 13th 09 07:40 PM
multiple selection.... AND Excel Worksheet Functions 1 February 13th 09 12:35 AM
How do I allow a multiple selection from a dropdown? Monica Excel Discussion (Misc queries) 11 April 17th 08 04:34 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
multiple selection Michalll Excel Programming 3 December 3rd 03 12:58 AM


All times are GMT +1. The time now is 01:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"