Move contents of entire column

  • Thread starter Thread starter Matthew
  • Start date Start date
M

Matthew

Is there a way to programatically move the contents of an
entire column to another? (i.e. switch the contents of
column A with the contents of column C). Any help is
greatly appreciated as always. Thankyou.

Matthew.
 
Hi Matthew,

Columns("A:A").Cut
Columns("C:C").Insert Shift:=xlToRight
Columns("C:C").Cut
Columns("A:A").Insert Shift:=xlToRight

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hi
I would do it as following (and you can record a macro while doing this
manually):
- copy one column to a helper column (e.g. column IV)
- copy col. 2 to column 1
- copy columne IV to column 2
 
I believe this routine would swap Columns 1 & 3 (or A & C)

SwapColumns 1, 3

Sub SwapColumns(c1, c2)
Columns(c1).Copy
Columns(c2).Insert
Columns(c2 + 1).Cut
Columns(c1).Select
ActiveSheet.Paste
Columns(c2 + 1).Delete
End Sub

HTH
Dana DeLouis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top