1

I am trying to expand a named range table after I have inserted a new column before the first column. If I were to insert a column at the end, it would automatically add it to the table, but when adding it as the first column it does not.

I have tried the following but get a 'Subscript out of range error' when using a variable as the Lastrow entry instead of entering exactly the same number (I have watched the Lastrow variable get filled and am confident I am using the correct value).

What am I missing?

Sub InsertFirstCol()

Dim Lastrow As Integer

Worksheets("SHEETNAME").Activate
Lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

Columns(1).Select
Selection.Insert Shift:=xlToLeft, CopyOrigin:=xlFormatFromRightOrAbove
ActiveSheet.ListObjects("Table150").Resize Range(Cells(2, 1), Cells(2, Lastrow))

End Sub
Laucrimus
  • 33
  • 4

0 Answers0