ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro Help (https://www.excelbanter.com/excel-discussion-misc-queries/177408-macro-help.html)

Stan

Macro Help
 
Hello,

I'm trying to create a macro so that two columns are inserted every 12
columns starting with Column C. Any help would be appreciated.

Thanks.

Pete_UK

Macro Help
 
Here's one I've just recorded for you:

Sub Macro1()
Dim i As Integer
Range("C1").Select
ActiveCell.Columns("A:B").EntireColumn.Select
Selection.Insert Shift:=xlToRight
For i = 1 To 10
ActiveCell.Offset(0, 12).Columns("A:B").EntireColumn.Select
Selection.Insert Shift:=xlToRight
Next i
End Sub

This will insert two new columns C and D, then move 12 columns over
from the new columns and repeat 10 times. Just change the 10 and/or 12
to suit.

Hope this helps.

Pete

On Feb 21, 6:04*pm, stan wrote:
Hello,

I'm trying to create a macro so that two columns are inserted every 12
columns starting with Column C. *Any help would be appreciated. *

Thanks.




All times are GMT +1. The time now is 11:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com