Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default inserting more than one column

What would the VBA code be to insert 6 columns to the left of Col A? I
recorded a macro but I know there has to be a quick line of code that will do
the same things rather than 10 lines of code from the macro recorder. Thank
you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,480
Default inserting more than one column

Hi

Columns("A:F").Insert Shift:=xlToRight

--
Regards
Roger Govier

"SITCFanTN" wrote in message
...
What would the VBA code be to insert 6 columns to the left of Col A? I
recorded a macro but I know there has to be a quick line of code that will
do
the same things rather than 10 lines of code from the macro recorder.
Thank
you.

__________ Information from ESET Smart Security, version of virus
signature database 4751 (20100107) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus signature database 4751 (20100107) __________

The message was checked by ESET Smart Security.

http://www.eset.com



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default inserting more than one column

The generalize form of Roger's statement would be this...

NumberOfCols = 6
Columns("A").Resize(,NumberOfCols).Insert Shift:=xlToRight

where you can set a variable number of columns to insert, as needed. Make
sure you note the comma in front of the variable named NumberOfCols inside
the Resize property call.

--
Rick (MVP - Excel)


"Roger Govier" <roger@technology4unospamdotcodotuk wrote in message
...
Hi

Columns("A:F").Insert Shift:=xlToRight

--
Regards
Roger Govier

"SITCFanTN" wrote in message
...
What would the VBA code be to insert 6 columns to the left of Col A? I
recorded a macro but I know there has to be a quick line of code that
will do
the same things rather than 10 lines of code from the macro recorder.
Thank
you.

__________ Information from ESET Smart Security, version of virus
signature database 4751 (20100107) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus
signature database 4751 (20100107) __________

The message was checked by ESET Smart Security.

http://www.eset.com




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
Inserting text in column dependant on another column Dave[_13_] Excel Worksheet Functions 3 December 8th 09 05:25 PM
Inserting a column Diane Goncalves[_2_] Excel Discussion (Misc queries) 1 March 8th 07 10:48 PM
inserting new column newyorkjoy Excel Discussion (Misc queries) 0 March 8th 07 08:22 PM
Inserting row/Column d_kight Excel Discussion (Misc queries) 1 December 11th 06 06:20 PM
inserting a column to the right Bryan Kelly Excel Programming 2 July 25th 04 01:13 PM


All times are GMT +1. The time now is 10:24 AM.

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"