Hi guys.
I really hope someone can help me. I am new to VBA and I have a large Excel sheet, that needs to be optimized. I need the cells in column "C" to show Low, Medium, High or Critical due to certain criteria.
- Cell "C25" is todays date inserted with the Today() formula.
- Column "H" is a Claim date, stated by a timestamp()
- Cell "AA" is the total value of a product
- Cell "AD" is an Action field with text
First of all, if a cell or row is blank, Range("C") must be blank as well.
And this function needs to apply as Column "C" becomes active.
If you are able to even optimize the code, please fell free to do so
My code:
Best regards![]()
Private Sub Claim_Importance() If Range("C25").Value = Range("H29").Value Or Range("AA29").Value > 3000 Or Range("AD29").Value > 0 Then Range("C29").Value = "Low" End If If Range("H29").Value + 2 > Range("C25").Value Or Range("AE29").Value > 0 Or Range("AA29").Value = 3000 Then Range("C29").Value = "Medium" End If If Range("H29").Value + 5 > Range("C25").Value Or Range("AF29").Value > 0 Or Range("AA29").Value > 3000 Then Range("C29").Value = "High" End If If Range("H29").Value + 7 > Range("C25").Value Then Range("C29").Value = "Critical" End If If Range("AA29").Value > 3000 Then Range("C29").Value = "Needs Approval" ElseIf Range("H29").Value = "" Then Range("C29").Value = "" End If End Sub
Daniel
Bookmarks