Melowshipslinki
New Member
Very new to Excel/VBA- I only know what little I've taught myself so far. And so far, so good for my purposes- I just need a few more bells and whistles in my workbook to make it more user-friendly. Unfortunately, I cannot attach samples, as the information contained is sensitive and proprietary. Apologies!
In one of my sheets, in my "NOTES" column (H), I need to have a message box appear when one or two certain invalid words/phrases are entered into any cell in that column.
I tried using data validation, but either I don't have the right reverse-logic formula or the tool doesn't allow for data 'invalidation'. I would like to try and do this in VBA though.
I have tried to combine a WorkBook_open function with an Update_Time function and a Worksheet Change event (am I even using the right language to explain?), as I need the code to run continuously as my users enter data. I've been stopped at every turn by various errors.
I do believe I need an If function with the msgbox as the action. Here is an example of what I am trying to accomplish:
In ThisWorkBook, I have entered:
Private Sub Workbook_Open()
Run Update_Time
End Sub
In the VBA editor for the Sheet containing the cells in question, I have entered:
Sub Update_Time()
Application.OnTime Now() + TimeValue("00:00:01"), "WorkSheet_Change"
End Sub
__________________________________________________________________________________
Private Sub WorkSheet_Change(ByVal Target As Range)
If ActiveSheet.Range("H13").Value = "*tah*" Then
MsgBox "Please Replace with ""Absent Since (X)year""", vbOKOnly, "Exclusion Not Specific Enough"
End If
End Sub
Of all the articles I've searched, I can't grasp through staring at the examples, how my particular circumstance should be formatted. I have nothing defined here, I'm getting 'object' errors. If someone could set me up and give me a primitive explanation that would be wonderful! Thank you
In one of my sheets, in my "NOTES" column (H), I need to have a message box appear when one or two certain invalid words/phrases are entered into any cell in that column.
I tried using data validation, but either I don't have the right reverse-logic formula or the tool doesn't allow for data 'invalidation'. I would like to try and do this in VBA though.
I have tried to combine a WorkBook_open function with an Update_Time function and a Worksheet Change event (am I even using the right language to explain?), as I need the code to run continuously as my users enter data. I've been stopped at every turn by various errors.
I do believe I need an If function with the msgbox as the action. Here is an example of what I am trying to accomplish:
In ThisWorkBook, I have entered:
Private Sub Workbook_Open()
Run Update_Time
End Sub
In the VBA editor for the Sheet containing the cells in question, I have entered:
Sub Update_Time()
Application.OnTime Now() + TimeValue("00:00:01"), "WorkSheet_Change"
End Sub
__________________________________________________________________________________
Private Sub WorkSheet_Change(ByVal Target As Range)
If ActiveSheet.Range("H13").Value = "*tah*" Then
MsgBox "Please Replace with ""Absent Since (X)year""", vbOKOnly, "Exclusion Not Specific Enough"
End If
End Sub
Of all the articles I've searched, I can't grasp through staring at the examples, how my particular circumstance should be formatted. I have nothing defined here, I'm getting 'object' errors. If someone could set me up and give me a primitive explanation that would be wonderful! Thank you