PDA

View Full Version : Macro To Insert Columns In Excel



jac3130
05-16-2013, 05:42 PM
I'm seeking a macro to insert a column to the right of columns C:N and R:W.

Thank you in advance for your help.

Excel Fox
05-16-2013, 07:49 PM
To the right of each column from C:N and R:W, or just one column to the right of R:W and C:N?

princ_wns
05-17-2013, 07:49 AM
Try this One..


Public Sub InsertColumns()

Dim intCol As Integer

Const strCol = "N:N" 'Here Just add the last Columns charactor Like "C:N"'s - N:N
Const strSheetName = "Sheet1" ''Here just add the sheet Name
Const intTotal = 5 'Here Pass the number of columns that you want to add

With ThisWorkbook.Worksheets(strSheetName)
For intCol = 1 To intTotal
.Columns(strCol).Insert xlRight
Next
End With

End Sub

:)

Regards
Prince