For example: I want to insert a column after C and call it "Area"
Before
Code: Select all
A B C D E
Length Width Height Error Phase
Code: Select all
A B C D E F
Length Width Height Area Error Phase
Dick
Moderators: JRL, Dorian (MJT support)
Code: Select all
A B C D E
Length Width Height Error Phase
Code: Select all
A B C D E F
Length Width Height Area Error Phase
Code: Select all
VBStart
Const xlToRight = -4161
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWB = objExcel.Workbooks.Open("I:\dick\TableTabFiles\Router_Lines_Used_Since_2018.xlsx")
Set objSheet = objwb.Sheets("Sheet1")
objSheet.Columns("D:D").Insert xlToRight
objWB.Close True
objExcel.Quit
VBEND