View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
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