I am trying to have a macro to insert columns, and I would like to be in control of whether the new column is inserted to the left or to the right of a certain column. Consider these two small macros:
Regardless of which of these two macros I use, the new column is inserted to the left of C. I had hoped that the InsertBefore macro should insert a column to the left of C and the InsertAfter macro should insert a column to the right of C, but that doesn't happen. What do I do wrong?
Bengt
Code:
Sub InsertBeforeC()
Columns("C:C").Select
Selection.Insert Shift:=xlToLeft, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub
Sub InsertAfterC()
Columns("C:C").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub
Regardless of which of these two macros I use, the new column is inserted to the left of C. I had hoped that the InsertBefore macro should insert a column to the left of C and the InsertAfter macro should insert a column to the right of C, but that doesn't happen. What do I do wrong?
Bengt