Dynamic Email VBA

KasperSSI

New Member
Joined
Nov 28, 2019
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hi,

Im looking for some help or inspiration for my project. I have created a dynamic range that show which employees are missing their time reg.

I have made the code so it finds the "To be approved" coloumn. but now i want it to look verticaly to find the "missing" and sum up the names for each approver and send that list in an email.

So in this case, SCH should have a list of two people and MME should have a list of one.

Do you have any suggestions or inspiration for this "issue" ? :)

1716135756984.png

1716135787881.png


Br
Kasper
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I have written something like this by filtering the columns, copying the visible cells to a new sheet, emailing that sheet, and then deleting that temporary sheet. If you want to go this route, let me know and I can send you some of the code.

The simplest method is to loop through the rows and see if the value in the cell is "Missing", but this is also the slowest. You could filter first, then loop through visible rows (I haven't tried this before, but it should work). A faster method is to read the data into an array and then do the same loop on the array. This is much faster than looping through the rows in the sheet.

Also, if you want to speed up your search for the Column title, I stole this from elsewhere: (I wrote my own version as a function, but this one should be faster.)
VBA Code:
Dim ColNum As Integer
Dim CWS As Worksheet

'Find the column number where the column header is
Set CWS = ActiveSheet
ColNum = Application.WorksheetFunction.Match("To be approved", CWS.Rows(1), 0)
This will get you a column number, but you can use "Cells(Row_Index,Column_Index)" to interact with the sheet as needed.
 
Upvote 0

Forum statistics

Threads
1,217,366
Messages
6,136,128
Members
449,993
Latest member
Sphere2215

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