Hi Mark
I am good too...
I just paste the code for your understanding. Try the following code....see it works for you or not?
Option Explicit
Sub InsertColumns()
Dim Ctr As Integer
Dim ColInsert As Integer
Dim ColName As String
Dim ColPos As Variant
Dim RunAgain As Integer
Application.ScreenUpdating = False
Do
StartPoint1:
ColName = InputBox("Enter the Column Name.", "Insert Columns", "A")
If IsNumeric(ColName) Then
MsgBox "Column Name should be Text only" & vbNewLine & "For example A, B, C Etc.", vbCritical
GoTo StartPoint1
End If
StartPoint2:
ColPos = InputBox("Enter the Column Position (Right,Left).", "Insert Columns", "Right")
If LCase(ColPos) = LCase("Right") Or LCase(ColPos) = LCase("Left") Then
Else
MsgBox "Column Position should be Left/Right!", vbCritical
GoTo StartPoint2
End If
ColPos = "xlTo" & ColPos
StartPoint3:
ColInsert = InputBox("How many columns need to be inserted?", "Insert Columns", 2)
If Not IsNumeric(ColInsert) Then
MsgBox "It should be numeric number only!", vbCritical
GoTo StartPoint3
End If
Application.ScreenUpdating = True
For Ctr = 1 To ColInsert
If WorksheetFunction.Proper(ColPos) = "Left" Then
Columns(ColName).Offset(0, 1).Insert Shift:=xlToRight
Else
Columns(ColName).Offset(0, 1).Insert Shift:=xlToLeft
End If
Next Ctr
RunAgain = MsgBox("Do you want to insert more column/s?", vbYesNo, "Excel")
Loop Until RunAgain = vbNo
End Sub
Here is the attachment..
Mark.xlsm
Thanks
Lokesh K.
Bookmarks