P
puiuluipui
Hi, i have this macro:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sh.Name <> "SEARCH" And Sh.Name <> "PLANNING" Then
If Not Application.Intersect(Target, Range("B5:B120")) Is Nothing Then
If Trim(Target.Text) <> "" Then
Application.EnableEvents = False
If WorksheetFunction.CountIf(Worksheets("PLANNING").Range("J4:J10"), _
Split(Target.Value)(0)) > 0 Then
MsgBox "NO COLABORATION", vbExclamation, ""
Range("C" & Target.Row).Activate
End If
Application.EnableEvents = True
End If
End If
End If
End Sub
I need to extract "NO COLABORATION" from range K4:K10. I don't want to have
"NO COLABORATION" in macro. i need to transform this:
MsgBox "NO COLABORATION", vbExclamation, ""
into something like this:
MsgBoxFunction.CountIf (Worksheets("PLANNING").Range("K4:K10")), _
Can this be done?
Thanks!
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sh.Name <> "SEARCH" And Sh.Name <> "PLANNING" Then
If Not Application.Intersect(Target, Range("B5:B120")) Is Nothing Then
If Trim(Target.Text) <> "" Then
Application.EnableEvents = False
If WorksheetFunction.CountIf(Worksheets("PLANNING").Range("J4:J10"), _
Split(Target.Value)(0)) > 0 Then
MsgBox "NO COLABORATION", vbExclamation, ""
Range("C" & Target.Row).Activate
End If
Application.EnableEvents = True
End If
End If
End If
End Sub
I need to extract "NO COLABORATION" from range K4:K10. I don't want to have
"NO COLABORATION" in macro. i need to transform this:
MsgBox "NO COLABORATION", vbExclamation, ""
into something like this:
MsgBoxFunction.CountIf (Worksheets("PLANNING").Range("K4:K10")), _
Can this be done?
Thanks!