Forum Discussion

dta255's avatar
dta255
Copper Contributor
Jul 02, 2019

Inserting New Columns of Empty Space between Pre-existing Columns

Hello,

 

I have an excel spreadsheet with about 50 columns and I want to insert new columns of empty space around every 5 columns (5th, 10th, 15th...). How would I go about doing that?

 

 

1 Reply

  • dta255 

    Hi,

    you can do it with the follwing macro:

     

    Sub InsertColumns()
    Dim lngCol As Long
    Dim lngColMax As Long

    With ActiveSheet
    lngColMax = 51

    For lngCol = lngColMax To 1 Step -5

    .Columns(lngCol).Insert

    Next lngCol

    End With

    End Sub

    Best regards Bernd

    https://vba-tanker.com

     

Resources