producing a macro code which only allows the user to continue if a quantity has been entered

zilch4ry

Board Regular
Joined
Feb 27, 2011
Messages
76
Hi all,

right.. I have been producing a pizza order spreadsheet, which involves the user completing a series of steps which will eventually produce their final order. Its a pretty simple way of collecting data however, I thought it would be a good idea to add a code to the beginning of a macro which will state they must order at least one pizza before continuing to the next stage. Basically what i was wondering is if anybody could give me a hand producing a macro which checks to see if any of the following cells has a value in them

Cells: H12, H22, H32, H43, H57

- If none of the quantity cells have any values in them (0) the macro will not proceed to the next stage, and an error message will appear saying something like "cannot proceed until at least one pizza has been ordered".

- If at least 1 (or all) of the cells include a quantity it means a pizza is being ordered so the macro at the end of step 1 will allow the user to proceed to the next step.

If anybody could help me with this this problem, it will be hugely appreciated.

Thanks all
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
sub pizza()

If cells(12,"H")>0 or cells(22,"H")>0 or cells(32,"H")>0 or cells(43,"H")>0 or cells(57,"H")>0 Then
msgbox("Please proceed to the next step")
Else
msgbox("Cannont proceed until at least one pizza has been ordered")
GoTo end_jmp
End If

end_jmp:

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,472
Members
452,915
Latest member
hannnahheileen

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