ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macros and Formulas (https://www.excelbanter.com/excel-worksheet-functions/198910-macros-formulas.html)

Daniel

Macros and Formulas
 
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

Mike H

Macros and Formulas
 
Daniel,
Try this


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

Mike
"Daniel" wrote:

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


Per Jessen

Macros and Formulas
 
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

"Daniel" skrev i meddelelsen
...
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

Macros and Formulas
 
Thanks!

I will try it out.

"Mike H" wrote:

Daniel,
Try this


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

Mike
"Daniel" wrote:

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


Don Guillett

Macros and Formulas
 
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
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Daniel" wrote in message
...
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




All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com