prevent running macro if lastrows doesn't contain DATE(TODAY)

Omran Y

New Member
Joined
Jul 17, 2023
Messages
49
Office Version
  1. 2013
Platform
  1. Windows
Hello,
I need procedure before call the main macro . if the last row doesn't contain date(today), then should show message box " the DATE is not TODAY" for lastrow " and exit sub , otherwise call my macro.
the DATE(TODAY) will be in MAIN sheet.
thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You said:
" if the last row doesn't contain date(today)"

The last row in what column?
Do you mean last row in column A with data?
 
Upvote 0
So, you want to run one Macro to see if today's date is in last row of column A on sheet named "Main Sheet". And if so, run another Macro,
So, what does the other Macro do?

And how is today's date entered into last row?
 
Upvote 0
So, what does the other Macro do?
will calculate for specific cells between two sheets.
date formatting will be dd/mm/yyyy
 
Upvote 0
With limited knowledge of exactly what you want try this:
Script looks down Column A of active sheet to see if today's date is in last filled cell in column A
Excel Formula:
Sub RectangleSingleCornerSnipped1_Click()
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
If Cells(Lastrow, 1).Value = Date Then
MsgBox "Yes Today is " & Date
Else
MsgBox "Not Today"
End If
End Sub
 
Upvote 0
Solution
perfect !
this is what I want it .(y)
much appreciated for your help.:love:
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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