I have this working for rows in the same way I'm trying to get it to work for columns now, but I am getting an error and unsure what I've missed.
The vCols variable are the number columns to be inserted picked up from another cell storing this from user input (there are some other things before this macro is called).
The columns are to be inserted 2 columns to the left of the last column (sum column and a spacer column).
The error is showing on the line:
I must also admit, I did take the row insertion code, and tried to adapt it to columns, which mightn't quite be the right way to have gone about this.
Any help would be appreciated.
Thanks
Code:
Summary.Select
FinalCol = Summary.Range("IV5").End(xlToLeft).Column - 2
Columns(FinalCol).Select
ActiveCell.EntireColumn.Select
vCols = Workings1.Cells(8, 3).Value
Selection.Resize(columnsize:=2).Columns(2).EntireColumn. _
Resize(columnsize:=vCols).Insert Shift:=xlToRight
Selection.AutoFill Selection.Resize( _
columnsize:=vCols + 1), xlFillDefault
On Error Resume Next 'to handle no constants in range
' to remove the non-formulas
Selection.Offset(1).Resize(vCols).EntireColumn. _
SpecialCells(xlConstants).ClearContents
The vCols variable are the number columns to be inserted picked up from another cell storing this from user input (there are some other things before this macro is called).
The columns are to be inserted 2 columns to the left of the last column (sum column and a spacer column).
The error is showing on the line:
Code:
Selection.Resize(columnsize:=2).Columns(2).EntireColumn. _
Resize(columnsize:=vCols).Insert Shift:=xlToRight
I must also admit, I did take the row insertion code, and tried to adapt it to columns, which mightn't quite be the right way to have gone about this.
Any help would be appreciated.
Thanks