Prompt to Select an Option (Yes/No) if User Leaves Cell Blank

manona

New Member
Joined
Mar 22, 2016
Messages
40
Hi,

I'm creating a workbook that will be used by various users. Certain users will be accessing this workbook only to update information in certain tabs. In those tabs, there are cells that cannot be left blank; there needs to be a yes or no.

Is there any way to prompt a yes/no if the user is about to leave the tab and has not addressed those cells?

I have some basic VB experience, I usually manage to get around, but am not 100% familiar with all the lingo yet.

Thank you for your time and help in advance, it's really appreciated! :rolleyes:
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Of course, you will need to change the range address and the sheet name. Place this code in the Sheet Level module under Microsoft Excel Objects.

Code:
Private Sub Worksheet_Deactivate()  
  If UCase(Range("G5").Value) <> "YES" And UCase(Range("G5").Value) <> "NO" Then
    
    Sheets("sheet1").Activate
    Range("G5").Select
    MsgBox "Hey!  I need an answer."
    
  End If
  
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

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