Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Introduce new column using VBA macros

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Introduce new column using VBA macros

Hi Swamy

This code should work assuming that your first column is "A" (if not
change the column number in the code appropriately.

Sub InsertColumn()
Columns("E:E").Select
Selection.Insert Shift:=xlToRight
End Sub

Thanks and Regards
Karthik Bhat
Bangalore

  #3   Report Post  
Posted to microsoft.public.excel.programming
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Introduce new column using VBA macros

How can i insert a column
between 4 and 5 using VBA macros?


Hi.
Columns(5).Insert

HTH. :)
--
Dana DeLouis
Win XP & Office 2003


"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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Introduce new column using VBA macros

Er - somehow (how!) I read you wanted to insert 6 columns. Ignore my
previous and go with Dana's, or
Columns("E").Insert

Regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
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





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
Introduce Value in a cell with formula, option Filipemr Excel Discussion (Misc queries) 4 March 17th 07 11:02 PM
Introduce decimal point in a list of values in column. ssb Excel Discussion (Misc queries) 2 December 17th 06 11:19 PM
please introduce sorting by colors in excel DCDK Excel Discussion (Misc queries) 3 October 3rd 06 01:32 PM
please introduce sorting by colors in excel DCDK Excel Discussion (Misc queries) 0 October 3rd 06 11:08 AM


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