Show message if specific text in cell & date check are met

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,738
Office Version
  1. 2007
Platform
  1. Windows
Morning.
On my worksheet in column G will be various dates & Text.
In column A will be a date.

The code advice im looking for is as follows.
If text in column G = POSTED & date in column A is 30 days old then show Msgbox
Once im shown the Msgbox i can take it from there so it doesnt have to check for more than 30 days.


Thats it.
Thanks
 
Hmmm Another good question.
Honest answer then not sure.

If this is going to be an issue then i will advise users to just manually scroll up & look,not ideal but dont want helpes to get an headache over it when trying to help me.

Thanks
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
The value POSTED in column G 30 days from the current date.

The whole point of this is when i can open a claim with the Post Office.
Before 30 days is too early.
So you can only start a claim at 30 days.

The daily workload within 30 days could be real busy or just mild so the amount of rows the user needs to scroll up checking will vary.

I just thought a simple code which when the sheet is opened etc would make the task quicker & much better time saving exercise.
 
Upvote 0
I don't care why they are looking for something, I only want to know what they are looking for.

When The value POSTED in column G 30 days from the current date doesn't exist
what would they then be looking for ?
 
Upvote 0
Does this work for you ?
VBA Code:
Private Sub Worksheet_Activate()
    Application.Goto Sheets("POSTAGE").Range("A" & Rows.Count).End(xlUp), True
    ActiveWindow.SmallScroll UP:=14
    
    Dim cRow As Long, lastRow As Long
    lastRow = Range("A" & Rows.Count).End(xlUp).Row

    ' work from bottom up
    For cRow = lastRow To 7 Step -1
        ' check for POSTED
        If Range("G" & cRow).Value = "POSTED" Then
            ' check if more than 29 days back
            If Range("A" & cRow).Value < Date - 29 Then
                ' display message when more than 29 days back
                MsgBox "MOST RECENT DATE MORE THAN 29 DAYS OLD" & vbLf & vbLf & _
                       Range("A" & cRow).Value & vbLf & vbLf & _
                       "WHICH IS " & Date - Range("A" & cRow).Value & " DAYS OLD" & vbLf & _
                       "AND ON ROW " & cRow, vbCritical, "START CLAIM FOR NO SIG MESSAGE"
                ' select that date
                Range("A" & cRow).Select
                ' don't look any further
                Exit For
            End If
        End If
    Next
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top