Copy Column and insert

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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

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 said:
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.
 
Back
Top