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. |
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 |
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 |
All times are GMT +1. The time now is 03:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com