I am trying to I am trying to write a macro to loop through a column (Z), & find the cells with a "Yes" in them. When a Yes is found I am trying to generate the following Msg “"Check to verify veteran data is entered in FY ## REFERALS. "It's critical that the veteran data is captured." & “You have entered No into cell (cell name).
Here is some background:
Cell Range F4:F10, F13:F17 (Yes/No) is linked to Cell Range X4:X10, X13:X17, & has the following formula in Column X (=F4="no"). If No is found TRUE is return value.
Cell Range I4:I10, I13:I17 has a Check box & is linked to Cell Range W4:W10, W13:W17 (Boolean answer).
Cell Range Y4:Y10, Y13:Y17 has this formula =AND(W4=TRUE, X4=TRUE).
Cell Range Z4:Z10, Z13:Z17 has this formula =IF(Y4, "Yes", "No")
Here is my current code:
Currently it hangs on: If ReferralsCalled = False Then
I don’t know if my code is correct. I know that target.Address is not correct. I used it elsewhere & have not fixed it yet. Please inform me what I am doing wrong.
Any help is appreciated.
Here is some background:
Cell Range F4:F10, F13:F17 (Yes/No) is linked to Cell Range X4:X10, X13:X17, & has the following formula in Column X (=F4="no"). If No is found TRUE is return value.
Cell Range I4:I10, I13:I17 has a Check box & is linked to Cell Range W4:W10, W13:W17 (Boolean answer).
Cell Range Y4:Y10, Y13:Y17 has this formula =AND(W4=TRUE, X4=TRUE).
Cell Range Z4:Z10, Z13:Z17 has this formula =IF(Y4, "Yes", "No")
Here is my current code:
Code:
Private Sub Worksheet_Change(ByVal target As Range)
im rng As Range, cell As Range
Set rng = Range("Z:Z")
For Each cell In rng
Next cell
cell.Value = cell.Value
'The code below is a reminder to enter data in the Referral Workbook.
If Intersect(target, ActiveSheet.Range("Z:Z")) Is Nothing Then Exit Sub
If target.Value <> "Yes" Then Exit Sub
If ReferralsCalled = False Then
'Shows a 3 line message box.
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, "Vocational Services Database"
Call Referals
End If
End Sub
Currently it hangs on: If ReferralsCalled = False Then
I don’t know if my code is correct. I know that target.Address is not correct. I used it elsewhere & have not fixed it yet. Please inform me what I am doing wrong.
Any help is appreciated.