[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

MS Excel How to create a warning or validation box based upon text in a particular cell

Issue: Currently there is an IF formula to Enter text here if the "Status" in Column F = "On Hold"; Then there is conditional formatting for if the Comments Column is >0, then Highlight Yellow.

The PROBLEM is that once text is auto entered or a user types in the cell, the formula is automatically erased.

Is there a way to have a Warning Box associated with the Comments Column, so anytime a corresponding "On Hold" status is there a box will pop up informing the user to please enter comments?

This thread is directed towards fixes for issue 6- the description of the issues are also located on the Desc tab of the workbook. Issues 7-11 issues will be following in subsequent posts.

Thank you in advance for your assistance.
Test-Report-v2.xlsm
0
ckwillGWU
Asked:
ckwillGWU
  • 2
1 Solution
 
dlmilleCommented:
Do you want to lock the user at the cell until comments are posted?

This just prompts the user to enter comments, then lets the user continue.  See the last 2 if statements.  It prompts the user if the yellow comment is not there because it has been overwritten:

in Sheet1 codepage:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Value <> PreviousValue Then
        Sheets("log").Cells(65000, 1).End(xlUp).Offset(1, 0).Value = _
            Application.UserName & " changed cell " & Target.Address _
            & " from " & PreviousValue & " to " & Target.Value
    End If
    If Target.Count > 1 Then Exit Sub 'not handling at the moment - this is if more than one cell is changed simultaneously
    If Not Intersect(Target, Range("F:F")) Is Nothing Then
        If Target.Value = "On Hold" And Left(Range("I" & Target.Row).Formula, 1) <> "=" Then 'prompt user
            MsgBox "Please Enter comments for On HOLD status"
        End If
    End If
End Sub

Open in new window


One, perhaps better alternative could be to erase the comments and put the formula back in there?  What do you think?

See attached.

Dave
Test-Report-v2.xlsm
0
 
ckwillGWUAuthor Commented:
Thanks Dave, this works perfectly. I just modified the warning to read "Enter or Update" the comments. I'd rather leave the old comments for a running trail with each account.

Again, thanks again. 1 down :)
0
 
ckwillGWUAuthor Commented:
Very quick and accurate response on the first go! :)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now