VBA - Exit Macro If - Validation

Olly_S

New Member
Joined
Nov 8, 2021
Messages
8
Office Version
  1. 2021
Platform
  1. Windows
Hi,

I'm super new to VBA (althgouh I have a lot of experience with excel) and I have what I presume is a really easy question to solve for.

I've built a data entry form with some validation. Both work fine, but I've added Call Validation_PO (my validation sub) into the data entry Sub, and whilst a message box will pop up is the validation is not satisfied, the data entry form simply continues to run. Code as per;

1636709784635.png


What I would like to happen is that if the validation sub is not satisfied, then then the other sub stops. Im sure this is possible, but how do I do that?

Thanks!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Ah figured it out. You simply call the data entry sub at the end of the validation loop. Easy!
 
Upvote 0
Glad you got it sorted.
For the future, if you want help with vba code, please post the actual code (with code tags - see my signature block below) not a picture of your code because we cannot copy from that to test.
 
Upvote 0
Glad you got it sorted.
For the future, if you want help with vba code, please post the actual code (with code tags - see my signature block below) not a picture of your code because we cannot copy from that to test.
Thanks and noted. :)
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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