Still be able to send blank email with no data

hsolanki

Board Regular
Joined
Jan 16, 2020
Messages
204
Office Version
  1. 2010
Platform
  1. Windows
Hello I have an workbook whereby it has all the expiry dates and you can filter the each department which is on sheet2 filtered from sheet1 and show you any due dates for the selected department if there are any due dates and can send email based on filtered dates however problem is that although there are no expiry dates for selected filtered department you can still be able to send an email if there are no expiry dates.

i was wondering if there is any way we could avoid this e.g. if any of the department filtered and has got NO any due date then comes up with msgbox saying no new expiry date found for and the department name it was filtered for.

Thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
what about checking the last row in sheet2 after filtering?
if lastrow =1 (means no data below header) then msgbox and end
 
Upvote 0
Hi Tomasz thank you for promote respond would you help me with the code please as i would not know what to write
 
Upvote 0
Hi Tomasz i have tried below code but what it is doing when i filter the each department it is hiding the columns which has data. so when i select the department which has got data msgbox still comes up or when i tried with 1 then it will still sends out the blank email which has got no data.

VBA Code:
If lastrow = 0 Then
MsgBox "NO new Due dates"
Exit Sub
End If
 
Upvote 0

Forum statistics

Threads
1,223,713
Messages
6,174,038
Members
452,542
Latest member
Bricklin

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