Formula writing in macro

mattyhigginsuk

New Member
Joined
Feb 24, 2006
Messages
16
Can anyone tell me how I can get a macro to perform the following calculation please? I have absolutely no VBA knowledge, so don't know what on earth to type in!!!

F14=(1+(F11*F12/12))*F9/F12

Also, how do I get it to check that all of the other cells are present and correct? Presume if one's empty, it will just give the error message otherwise???

Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Try like this

Code:
Sub fmla()
If Range("F12").Value <> "" Then
    Range("F14").Formula = "=(1+(F11*F12/12))*F9/F12"
Else
    Range("F14").Value = "Error"
End If
End Sub
 
Upvote 0
i think he means to have it evaluated...

Code:
Sub fmla()
    If Range("F12").Value <> "" Then
        Range("F14") =(1+(range("F11") * range("F12") / 12 ) ) * range("F9") / range("F12")
    Else
        Range("F14").Value = "Error"
    End If
End Sub

i think, anyway...
 
Upvote 0
Andrew,

I'm looking to point a button click towards the macro. I will have several buttons on the spreadsheet next to the individual variables that make up the formula, so that I can instantly solve for their value if I have changed one or more of the others.

Thanks,

Matt
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top