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:
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
1,766
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
 

Watch MrExcel Video

Forum statistics

Threads
1,108,655
Messages
5,524,135
Members
409,562
Latest member
meeranaskar

This Week's Hot Topics

Top