Attach a value to a Marco

adamswalwell

New Member
Joined
Nov 4, 2005
Messages
29
I am trying to construct a system for a Fish and Chip shop:

What I want to do is to be able to click on a macro button (for example chips) and it will then return the value of 1 portion of chips and the word chips into a reciept worksheet and also deduct the value 1 from a stock sheet, so that the value of 1 is deducted everytime the chips macro button is clicked.

Any help would be really appreciated
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
This forum helps those who help themselves. That is, if you post information of what you have done, then ask a specific question, all will be happy to help. But, most of the homework must be done by the student, before he asks for help. Otherwise, he will never learn!
 
Upvote 0
Thanks for the flattery but you may not have understood, I have the basic outline of my system and all the links between the worksheets the only think I need to be able to finish it is the code to which I can click on a Macro Button and it will add that product and price onto my reciept worksheet and deduct the amount of 1 from a specific cell on my stock worksheet for everytime the button is clicked on. I am creating this for my very own Fish & Chip Shop in order to make the functions within it more successful.

Therefore any useful help that you may be able to provide would be dearly appreaciated
 
Upvote 0
adamswalwell:
My face is red! Please accept my sincere apolgy for my misinterpretation.

Your problem sounded so much similar to the example given in John Smiley's "Learn to Program with Visual Basic 6", that I thought your problem was homework!

And, since I don't know VBA, I cannot he;lp you, even though I would have liked to do so.
 
Upvote 0
Thanks anyway for just distinguishing between the person looking for school work help and the person actually trying to construct a system to assit their shop.

Therefore is there anybody out there who has the code to which I am able to add 2 values to a Macro button. 1 which will add to a reciept worksheet the price of a portion of chips and the detailsm a portion of chips and deduct the value of 1 from a stock intake worksheet.

Is there anybody who can help me please!!
 
Upvote 0
adamswalwell said:
Therefore is there anybody out there who has the code to which I am able to add 2 values to a Macro button. 1 which will add to a reciept worksheet the price of a portion of chips and the detailsm a portion of chips and deduct the value of 1 from a stock intake worksheet.
Hello, adamswalwell
Welcome to the Board !
here a little example of macro
Code:
Sub test()
Range("stocktotal") = Range("stocktotal") + 1
End Sub
this assumes you have named your range
else you can use something like
Sheets("stock").Range("A1") = ...

if your question was also about how to create buttons and assign macros to them

If you don't already have the "Forms" toolbar active, click on Tools>Customize>Toolbars and check "Forms". The toolbar will appear on your screen; drag it down to the bottom of your screen to anchor it.

Click on the Button icon, and drag out a button on the screen. When you release the left mouse button, an "Assign Macro" dialogue box will appear. Highlight your macro "test", and click OK. The macro will now be assigned to that button.

..........................................

If the button is already created:
If your button is made with the Forms Toolbar

start the Visual Basic Editor (via Menu Tools, Macro or press ALT+F11).
On the Insert menu in the VBE, click Module. (if necessary)
In the module (the white area at the right), paste the following code:
Code:
Sub test1()
MsgBox "Hello"
End Sub

right click on the button
choose "assign macro"
choose macro test1

clicking on the button you will get "Hello"

if you're button is created with the Controls Toolbar
choose "show programm code" from the rightclick menu

you will get this
Code:
Private Sub CommandButton1_Click()

End Sub
where you can fill in your macro

Code:
Private Sub CommandButton1_Click()
MsgBox "Welcome to the Board",48,"HELLO"
End Sub

kind regards,
Erik
 
Upvote 0

Forum statistics

Threads
1,214,560
Messages
6,120,217
Members
448,951
Latest member
jennlynn

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