Macro button with multiple IF functions

ExcelCosby

New Member
Joined
Jan 25, 2015
Messages
2
Hello everyone! I've recently been using Excel 2013 on my free time and I wanted to create a Slot Machine. I've used RANDBETWEEN, IF and COUNTIF to display a price in cell L11 if three cells below it have the same words in them. It's working properly but my main problem has been with macros, since I know very little about them.

What I want to do is have a cell (for example, L9) that displays your total money. When you press a macro button, it subtracts 10 from the total money. If the price (L11) displays, for example, "10€" then I want it to add 10 to the total money. If the price displays a bigger price, it adds that to the total money.

I know you have to use VBA for this but since I don't know anything about it, I'd appreciate any help that I can get. Thanks!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try this:

Code:
Sub T()

    ActiveSheet.Calculate
    
    Cells(9, "L") = Cells(9, "L") - 10
    
    If IsNumeric(Cells(11, "L")) Then
        Cells(9, "L") = Cells(9, "L") + Cells(11, "L")
    End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,806
Messages
6,121,667
Members
449,045
Latest member
Marcus05

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