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!

:)
 

Some videos you may like

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,280
Office Version
  1. 365
Platform
  1. Windows
Something like
Code:
ElseIf Cells(5,3).Value="No" Then
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,280
Office Version
  1. 365
Platform
  1. Windows
Glad to help & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,123,281
Messages
5,600,715
Members
414,401
Latest member
grenona2020

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
Top