ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying Multiple Columns (https://www.excelbanter.com/excel-programming/331094-copying-multiple-columns.html)

Randall

Copying Multiple Columns
 
How do you copy multiple (non-consecutive) columns using the numeric values
of the columns? In other word I am looking for code that does this:
Range("C:C,E:E,G:G").Copy
But, using numbers like this:
Columns(3,5,7).Copy €˜This doesnt work
Any ideas?

Tx,
Randall


Vasant Nanavati

Copying Multiple Columns
 
Range("3:3,5:5,7:7").Copy

--

Vasant

"Randall" wrote in message
...
How do you copy multiple (non-consecutive) columns using the numeric

values
of the columns? In other word I am looking for code that does this:
Range("C:C,E:E,G:G").Copy
But, using numbers like this:
Columns(3,5,7).Copy 'This doesn't work
Any ideas?

Tx,
Randall




Randall

Copying Multiple Columns
 
The code:

Range("3:3,5:5,7:7").Copy

copies rows not Columns. How do you do the same thing but for COLUMNS?


"Vasant Nanavati" wrote:

Range("3:3,5:5,7:7").Copy

--

Vasant

"Randall" wrote in message
...
How do you copy multiple (non-consecutive) columns using the numeric

values
of the columns? In other word I am looking for code that does this:
Range("C:C,E:E,G:G").Copy
But, using numbers like this:
Columns(3,5,7).Copy 'This doesn't work
Any ideas?

Tx,
Randall





Tom Ogilvy

Copying Multiple Columns
 
Range("C:C,E:E,G:G").Copy

--
Regards,
Tom Ogilvy


"Randall" wrote in message
...
The code:

Range("3:3,5:5,7:7").Copy

copies rows not Columns. How do you do the same thing but for COLUMNS?


"Vasant Nanavati" wrote:

Range("3:3,5:5,7:7").Copy

--

Vasant

"Randall" wrote in message
...
How do you copy multiple (non-consecutive) columns using the numeric

values
of the columns? In other word I am looking for code that does this:
Range("C:C,E:E,G:G").Copy
But, using numbers like this:
Columns(3,5,7).Copy 'This doesn't work
Any ideas?

Tx,
Randall







Vasant Nanavati

Copying Multiple Columns
 
Sorry; long day at work.

Probably better ways, but perhaps:

Union(Columns(3),Columns(5),Columns(7)).Copy

--

Vasant



"Randall" wrote in message
...
The code:

Range("3:3,5:5,7:7").Copy

copies rows not Columns. How do you do the same thing but for COLUMNS?


"Vasant Nanavati" wrote:

Range("3:3,5:5,7:7").Copy

--

Vasant

"Randall" wrote in message
...
How do you copy multiple (non-consecutive) columns using the numeric

values
of the columns? In other word I am looking for code that does this:
Range("C:C,E:E,G:G").Copy
But, using numbers like this:
Columns(3,5,7).Copy 'This doesn't work
Any ideas?

Tx,
Randall








All times are GMT +1. The time now is 08:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com