Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Copy Column and insert

I have the following code that inserts a column next to the active column.

Sub AddColumnt()
ActiveCell.Offset(0, 1).EntireColumn.Insert
End Sub

I would like to copy and paste A1:A10 into the new column. What do I need to add to the macro?

Thanks so much!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Copy Column and insert

Denise

You don't actually say where you want the range copied to but this amendment
copies it to the cells adjacent to the active cell.

Sub AddColumnt()
ActiveCell.Offset(0, 1).EntireColumn.Insert
Range("A1:A10").Copy ActiveCell.Offset(0, 1)
End Sub

Regards

Trevor


"Denise" wrote in message
...
I have the following code that inserts a column next to the active column.

Sub AddColumnt()
ActiveCell.Offset(0, 1).EntireColumn.Insert
End Sub

I would like to copy and paste A1:A10 into the new column. What do I need

to add to the macro?

Thanks so much!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Copy Column and insert

Sorry it did get CF but not cell format (borders) or formulas
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Copy Column and insert

Denise

it's just a copy statement. It should, and does, copy everything. The
formulae will, of course relate to cells relative to where they have been
copied to, so the results may be "wrong".

I have just tested that it copies borders, conditional formatting and
formulae.

Regards

Trevor


"Denise" wrote in message
...
Thanks Trevor this works great. However its not copying the formatting

both the cells and conditional formatting. If does on the other hand pickup
validation.


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
Insert Column after specific text title the new column and add for David Excel Discussion (Misc queries) 5 October 2nd 09 04:03 PM
insert a blank column between each column in a data file Holly Excel Discussion (Misc queries) 1 October 31st 07 07:04 PM
insert row / insert column command buttons fairgreen Excel Worksheet Functions 1 October 29th 07 02:41 PM
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
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 08:55 PM.

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

About Us

"It's about Microsoft Excel"