LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Copy columns and paste with blank column between

This will get the job done, but seems really clunky to me.
Where I have a number of columns on sheet 1, some are longer than others, and want to copy them to sheet 2 with a blank column between each copied column.

So I could just continue to duplicate the lines column A to A and then column B to C and then column C to E and so on, but there has to be a cleaner way.

Also, the number of columns on the first sheet (copy from) could vary so I would need to use something like this to determine the number of columns.

i = Cells(1).End(xlToRight).Column

Thanks,
Howard


Option Explicit

Sub CopyCol()

Range("A1:A" & Range("A1").End(xlDown).Row).Copy
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp)(2).PasteSpecial Paste:=xlPasteValues

Range("B1:B" & Range("B1").End(xlDown).Row).Copy
Sheets("Sheet2").Range("C" & Rows.Count).End(xlUp)(2).PasteSpecial Paste:=xlPasteValues

Range("C1:C" & Range("C1").End(xlDown).Row).Copy
Sheets("Sheet2").Range("E" & Rows.Count).End(xlUp)(2).PasteSpecial Paste:=xlPasteValues

End Sub
 
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
Copy Multiple Columns, Paste Under a Single column Sriram Excel Worksheet Functions 12 April 4th 23 11:37 AM
Copy and Paste Formula from ActiveCell to cells in 13 columns priorto the active column sgltaylor Excel Programming 1 November 30th 09 10:33 AM
Need macro to check if cell is not blank & previous cell is blank, copy information from row above & paste JenIT Excel Programming 4 April 12th 07 08:56 PM
Cut & Paste into column only if column cell is blank. [email protected][_2_] Excel Programming 0 June 22nd 06 09:02 PM
Macro copy and paste = blank worksheet efface Excel Discussion (Misc queries) 1 April 27th 06 09:52 PM


All times are GMT +1. The time now is 06:38 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"