store formula in macro then paste it when macro runs

  • Thread starter Thread starter Nina
  • Start date Start date
N

Nina

I download a file every month and I need to format it adding columns,
deleting rows, etc - also I need to add some formulas to the file so that the
data is formatted according to my specifications and to be used in another
model.

The formula is to be pasted on cell B3 ... and the formula is
=RIGHT(LEFT(A3,16),3).

Thanks
 
Is this what you need?

Sub PasteFormula()

Range("B3").Formula = "=RIGHT(LEFT(A3,16),3)"

End Sub
 
Would this formula pasted into B3 have to copied down as far as you have
data in Column A?

Sub Auto_Fill()
Dim lRow As Long
With ActiveSheet
Range("B3").Formula = "=MID(A3,14,3)" 'using p45cal's version
lRow = .Range("A" & Rows.Count).End(xlUp).Row
.Range("B3:B" & lRow).FillDown
End With
End Sub


Gord Dibben MS Excel MVP
 
Back
Top