Message Box Code

SarahBear

New Member
Joined
Aug 14, 2014
Messages
10
I have some code which prompts users to fill in all the required fields in an excel worksheet before a copy of the sheet is created. I want to add something into the code to also prompt users to select a reason if they have entered a value of 'No' in a previous cell. I have done some googling but to be perfectly honest I'm not entirely sure what I should be googling for!

This is the current code;

Code:
Sub CreateAgentCopy()
    If IsEmpty(Cells(3, 3)) Then
        MsgBox "You must complete Agent Name"
    ElseIf IsEmpty(Cells(4, 3)) Then
        MsgBox "You must complete Team Leader name"
    ElseIf IsEmpty(Cells(5, 3)) Then
        MsgBox "You must complete Call Date"

I want to add a further ElseIf in that comes up with the message to prompt the user to select the reason code if the previous cell has been given a value of 'No'. I'm assuming this would be defined in the same way as the IsEmpty part of the code but I have no idea what to put. I tried 'ElseIf IsNo' but that didn't work.

Any guidance would be greatly appreciated!

:)
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Something like
Code:
ElseIf Cells(5,3).Value="No" Then
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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