Macros and Formulas

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

I would like to create a macro which will insert a function which
incorporates different cells. For example, =($A$3 * B3) where the B3 will
become B4 in the next cell below. Is this possible?

Thanks,

Daniel
 
Daniel,
Try this


Sub mariner()
Range("B3").Formula = "=$A$3*B3"
Range("B3").AutoFill Destination:=Range("B3:B50")
End Sub

Mike
 
Hi Daniel

Maybe this will help you:

Sub InsertFunction()
For r = 3 To 10
Cells(r, "C").Formula = "=($A$3 * B" & r & ")"
Next
End Sub

Regards,
Per
 
Thanks!

I will try it out.

Mike H said:
Daniel,
Try this


Sub mariner()
Range("B3").Formula = "=$A$3*B3"
Range("B3").AutoFill Destination:=Range("B3:B50")
End Sub

Mike
 
Sub autofilformulas()
For i = 1 To 3
Cells(i, "H").Formula = "=$b$3*h" & i
Next i
End Sub
or

Sub autofilformulas()
For i = 1 To 3
'Cells(i, "H").Formula = "=$b$3*h" & i
Cells(i, "H").Value = Range("b3") * Range(h" & i)
Next i
End Sub
 
Back
Top