Requiring popup message to run after 2 conditions are met.

FrancisM

Board Regular
Joined
Apr 12, 2016
Messages
139
I am trying to get a pop up message to run if the following 2 conditions are met "No" & "True". No is in cell range G4:G10, G13:G17; True is located in W4:W10, W13:W17. However true is a Boolean answer. I do have a formula located in cell range x4:x10, x13:x17 that concerts the Boolean answer to a 1 or 0. I thought that you had to convert a Boolean answer to a numeric answer to use in code.
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
     'The code below is a reminder to enter data in the Referral Workbook.
     Application.ScreenUpdating = False
     Dim lastRow As Long
     Dim cell As Range
     lastRow = Range("G" & Rows.Count).End(xlUp).Row


For Each cell In Range("G4:G10, G13:g17" & lastRow)
    If InStr(1, cell.Value, "No") <> 0 Then
        If InStr(1, cell.Offset(, 17).Value, "1") <> 0 Then
        End If
    End If
Next


Application.ScreenUpdating = True
         MsgBox "Check to verify veteran data is entered in FY ## REFERALS." & vbCr & _
                "It's critical that the veteran data is captured." & vbCr & _
                "You have entered No into cell" & Target.Address, vbInformation, "Career Link Meeting List"
   
        Call Referals
    
  
 End Sub
When I run the code it sees the "no" & runs the message, & calls Referals. I have are 3 questions.
1.Do you have to convert Boolean answers to numeric?
2. How do you get excel to see the second condition?
3. Could you,explain what I am doing wrong?
 
And your getting the msgbox saying "You have No & true" appearing when the row does not have "No" & true on the same row?
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Ok, select the entire row where it's giving the wrong result & then run this
Code:
Sub Chk()
   Debug.Print "|" & join(Application.Index(Selection, 1, Array(7, 23)), "|") & "|"
End Sub
Below the code window there should be the Immediate window (Ctrl G will bring it up if it's not visible)copy and paste whatever is in the immediate window to the thread
 
Upvote 0
When I put ' in front of my msgbox the is no response from the code. If I remove it, it appears that it is bypassing the code & going straight to my message.
 
Upvote 0
In the code I supplied in post#26 I had deliberately commented out your message box, in order to avoid any possible misunderstanding. Also in post#31 I asked
And your getting the msgbox saying "You have No & true" appearing when the row does not have "No" & true on the same row?
If you make changes to code supplied and/or do not accurately reply to question, it is very difficult to help.
Please run the code again, dose the msgbox saying "You have No & true" appear & if so is it on the correct row?
 
Upvote 0
Yup that's fine, just post the link to the thread.
 
Last edited:
Upvote 0
Thanks for the file, but which sheets is the code meant to work on?
Some of the sheets have a Yes/No dropdown in col F rather than G, but col W is blank
 
Upvote 0
Interesting! Thanks for letting me know. I plan on deleting all non report/chart sheets, except October_Meetin_#_1. I checked that sheet & column G does have yes/no, & Column W does have a Boolean answer TRUE/FALSE. That is related to column H, a check box. When the box is checked it changes to TRUE. Again thanks for finding those errors.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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