• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

how to insert multipul row Between 10 selected row

Hold control key and select row 1, then row 2, then row 3... then row 10. Now right click and choose insert. This will insert one row between every row.
 
My question is similar to this. But it's for columns. I have a spreadsheet with 500 active columns, and I need to insert a blank column between each of these 500 columns. Now the hard way of doing this is to hold Ctrl key and select the column head of column b, then column c, then column d, and go on till you individually select all 499 column heads, then right click and choose insert. But this method will take you a lot of time and can be quite tedious to do on a daily basis. My question is, is there a shorter way, or command to select the column heads individually to insert multiple blank columns in between a vast number of columns. First, I thought I can select the column head of column B, and then drag it along till the column head of the last column, and then insert. but this did not work. I hope you can help me out on this.

Thanks a lot. Salsinho <salsinho@gmail.com>
 
Hi SALSINHO,


Try this code in the sheet module:


'Sub insertCol()

Dim lng As Long


'Counts the number of active columns in row 1

lng = Cells(1, Columns.Count).End(xlToLeft).Column


'Inserts rows between columns

For lng = lng To 2 Step -1

Columns(lng).Insert Shift:=xlToRight

Next


End Sub'


Hope this helps.
 
Varak, thank you very much for this macro. I tried it and it worked flawlessly. This will indeed save me a lot of time and boredom in doing my daily pricing. Once again thanks a lot for your assistance.
 
Back
Top