View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Introduce new column using VBA macros

Hi Swamy,

If you record a macro -

Columns("E:J").Select
Selection.Insert Shift:=xlToRight

But as recording macros also record unnecessary key strokes like selecting
cells or, in this case, columns, it can be simplified -

Sub InsertColumns()

Columns("E:J").Insert Shift:=xlToRight

End Sub

This assumes of course you want to insert 6 columns between D & E.

Regards,
Peter T

"Swamy" wrote in message
...
Hi,

I have 6 columns already in my Excel document. How can i insert a column
between 4 and 5 using VBA macros?

Thanks for your help.

Swamy