Code:
Sub AddAColumn()
Dim varUserInput As Variant
Dim ColNum As Variant
varUserInput = InputBox("Enter Column Number where you want to add a Column:", _
"What Column?")
If varUserInput = "" Then Exit Sub
ColNum = varUserInput
Rows(ColNum & ":" & ColNum).Insert Shift:=xlDown
Rows(ColNum - 1 & ":" & ColNum - 1).Copy Range("AV" & ColNum)
Range(ColNum & ":" & ColNum).ClearContents
End Sub
user need to give value in input box ,how many columns need to insert
if user give 2 in input box
2 columns need to insert after AV Column
Command Button 2
Delete Columns Through Input Box
if user give 1 column
one Column need to delete after "AV"
if user give more than 5 Columns i need to give restriction "Msg box need to pop up"
"we cant delete more than 5 columns" or any Alternative ?
Tnx In Advance
Last edited: