Hi, mariosmk555,
you should be more precise in what you are asking. In the opening post it was one column (the last one) which should be shifted. Now itīs two columns, and Iīm not so sure about the columns you have used or the range where to insert:
Sub EF1008505_4()
'insert two columns before the last two columns of data
Dim lngIns As Long
lngIns = Cells(1, Columns.Count).End(xlToLeft).Column - 1
If lngIns < 3 Then lngIns = 3
Cells(1, lngIns).Resize(1, 2).EntireColumn.Insert
End Sub
Sub EF1008505_5()
'will start at Column C and add two columns when the workbook isnīt closed in the meantime
'If you wan to keep the value for the next opening you could write it to a cell on a hidden sheet,
'use a Name to store it or store the value in a textfile.
Static lngIns As Long
If lngIns = 0 Then
lngIns = 3
Else
lngIns = lngIns + 2
End If
Cells(1, lngIns).Resize(1, 2).EntireColumn.Insert
End Sub
Ciao,
Holger
Bookmarks