From: Alex on

I have a macro that susscessfulling inserts any number of columns, however
it is SUPPOSED to keep all the formulas and clear the contents of the
inserted columns, which it does do, so that is problem number 1.

Now what i need is for the total column to be updated automatically with the
number of columns inserted. The total column has a formulae of what ever that
rows entered value is multipied by the header row value users select for that

if this possibe?

here is what i have so far:
Sub InsertColAndFillFormulas(Optional vCols As Long = 0)

Dim x As Long
If vCols = 0 Then
vCols = Application.InputBox(prompt:= _
"How many columns do you want to add?", Title:="Add Columns", _
Default:=1, Type:=1) 'Default for 1 col, type 1 is number
If vCols = False Then Exit Sub
End If

Dim sht As Worksheet, shts() As String, i As Long
ReDim shts(1 To Worksheets.Application.ActiveWorkbook. _
i = 0
For Each sht In _
i = i + 1
shts(i) = sht.Name

x = Sheets(sht.Name).UsedRange.Columns.Count 'lastcell fixup

Selection.Resize(Columnsize:=2).Columns(2).EntireColumn. _

Selection.AutoFill Selection.Resize( _
Columnsize:=vCols + 1), xlFillDefault

On Error Resume Next
Selection.Offset(1).Resize(vCols).EntireColumn. _
Next sht
End Sub