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

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,832
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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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
Sorry to say but for some reason that also didnt work for me.
I even put the value POSTED in many cells then tried it again but never did i see the Msgbox appear
 
Upvote 0
Thanks for the effrorts but i think we will put this to bed & have users check it manually
 
Upvote 0
One more thing to try - can you put the formula =ISNUMBER(A2302) in a cell somewhere (assuming A2302 has a date in it) and tell us if it returns TRUE or FALSE.
 
Upvote 0
Not quite sure whats happening.

Row 2302 has a date in column A
Column D is empty so in the address bar i enter =ISNUMBER(A2302) & then enter.
I just see the value =ISNUMBER(A2302) now in that cell


I put the code in a row after 2302 & now i see FALSE
 
Upvote 0
Column D is formatted as text. When you put it in the row after, does it say A2302 or A2303?

Is it points to A2302 then there is your problem - the values in column A are text not dates. We can fix it if you tell us what your date format looks like.
 
Upvote 0

Forum statistics

Threads
1,225,012
Messages
6,182,354
Members
453,108
Latest member
bb43442

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