VBA Stop message

sherriwatkins

New Member
Joined
Jun 10, 2015
Messages
10
Hi,

I am trying to create a code that will create a stop message if a field is left blank. I have a macro to go to the next page that I want to change. It is not working correctly and I don't know what I have done wrong. The caveat is there are 16 hidden cells that will highlight grey based on s selection on a previous page. If there is 1 machine, only one shows up, if there are 16, then all 16 show up. I need this code to work only for the highlighted fields. Here is my current code.
Application.ScreenUpdating = False
Sheets("11").Visible = True

If Worksheets("10").Range("A10") < 1 Then
MsgBox ("You must enter the length of cable for the Ethernet Cable between 0 and 330 feet.")
ElseIf Worksheets("10").Range("A10") > 0 Then
Sheets("11").Select

Range("A1").Select


Sheets("10").Visible = False
Application.ScreenUpdating = True

Please help!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
you can use exit sub to exit out of the sub then after the amount is entered the code can be run again.
Code:
If Worksheets("10").Range("A10") < 1 Then[INDENT]MsgBox ("You must enter the length of cable for the Ethernet Cable between 0 and 330 feet.")[/INDENT]
[INDENT]Exit Sub[/INDENT]
else 'rest of your code
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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