Macros and Formulas

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
 
M

Mike H

Daniel,
Try this


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

Mike
 
P

Per Jessen

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
 
D

Daniel

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
 
D

Don Guillett

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top