Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default how to copy and move columns?

hi
i would like to know how i can move entire columns within a worksheet
itself. eg.- if i want to move column D and its entire contents, and
insert it in between column A and B, how should i go about it?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default how to copy and move columns?

i forgot to mention.. i have to use macros for that purpose

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default how to copy and move columns?

Sub MoveColumns()
Columns("D:D").Cut
Range("B1").Insert Shift:=xlToRight
End Sub

This should do the trick

I like to refer to columns using their number left to right
This example is a little more flexible

Sub MoveColumns()
x = 4 ' column to move
y = 1 'to the right of which column
Columns(x).Cut
Cells(1, y + 1).Insert Shift:=xlToRight
End Sub

change the values of x and y accordingly

http://www.excel-ant.co.uk 'underconstruction

ruchie wrote:
i forgot to mention.. i have to use macros for that purpose


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default how to copy and move columns?

thanks!!
that helped!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default how to copy and move columns?

columns(4).Cut Columns(2)


--
Regards,
Tom Ogilvy


"ruchie" wrote:

hi
i would like to know how i can move entire columns within a worksheet
itself. eg.- if i want to move column D and its entire contents, and
insert it in between column A and B, how should i go about it?




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
move two columns of data to four columns PB Excel Discussion (Misc queries) 1 February 24th 10 12:54 AM
move or copy sheets doesn't copy format ColinX Excel Worksheet Functions 1 May 14th 08 10:07 PM
Can I Move replace instead of Move copy [email protected] Excel Discussion (Misc queries) 2 January 9th 08 10:25 PM
move multiple columns into single set of columns mrg9999 Excel Discussion (Misc queries) 1 September 25th 07 05:08 AM
Move/Copy or Copy/Insert worksheet? kjk Excel Discussion (Misc queries) 0 December 15th 06 02:40 PM


All times are GMT +1. The time now is 05:32 PM.

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"