After completing a previous project for the company I work for, I have since been given extra responsibilities, one of which can be done quickly and efficiently using an excel workbook.
As it happens, the purpose of this task is almost the same as my last one, so I am able to use the same codes, however I am having a bit of difficulty adapting part of it.
I've adjusted the script so that it can function, but the bit I'm struggling with are the lines of code that highlight the cells that match the criteria, at present the script highlights single cells, but what I want it to do is highlight the entire row and I'm not sure how this can be done.
The code is as follows
Also, I spotted this thread and having a similar feature in my workbook would be great, but again I have a question about that:
Whilst I can follow and sort of understand the instructions on the link in that thread, I'm not really sure how to use Worksheet_SelectionChange and tell excel that whenever I click on a cell in Column F for example, the pop up calendar would open etc.
thanks in advance
As it happens, the purpose of this task is almost the same as my last one, so I am able to use the same codes, however I am having a bit of difficulty adapting part of it.
I've adjusted the script so that it can function, but the bit I'm struggling with are the lines of code that highlight the cells that match the criteria, at present the script highlights single cells, but what I want it to do is highlight the entire row and I'm not sure how this can be done.
The code is as follows
Code:
Dim DaysOld As Long, OrderDay As Range, lCount As Long
If Not IsNumeric(TextBox1.Value) Then
MsgBox "The ""Days Old"" value requires a number.", vbCritical, "Days Old Error."
Exit Sub
End If
'the above code checks that the value entered in the textbox is a number, and is not left blank
DaysOld = Int(TextBox1.Value)
For Each OrderDay In Range("F1", Range("F" & Rows.Count).End(xlUp)) 'Looks for the last used cell in Columns A-F
If IsDate(OrderDay) Then
If OrderDay.Value < Date - DaysOld Then 'if the date a collection is booked is less than todays date minus number of days entered in the text box
OrderDay.Interior.ColorIndex = 3 'colours the inside of the cell red
lCount = lCount + 1 'counts the number of collections coloured by above script
Else
OrderDay.Interior.ColorIndex = 0 'if a cell does not meet above criteria the fill colour is not applied
End If
End If
Next OrderDay
UserForm1.Hide 'closes the user form
If lCount = 0 Then
MsgBox "No orders found.", vbInformation, "Error" 'pop up announcement box
Else
MsgBox lCount & "collections need chasing.", vbInformation, "Information" 'displayed text example "10 collections need chasing"
End If
Also, I spotted this thread and having a similar feature in my workbook would be great, but again I have a question about that:
Whilst I can follow and sort of understand the instructions on the link in that thread, I'm not really sure how to use Worksheet_SelectionChange and tell excel that whenever I click on a cell in Column F for example, the pop up calendar would open etc.
thanks in advance