VBA to create a report for each person listed in column

sej2727

New Member
Joined
Oct 10, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello, first post. Will appreciate any help - even just a pointer to the correct place to look.
I'm struggling to word this requirement but here goes:

I have a data table in excel (a proper table). Each record contains a student and several other fields of use. It also details the teacher, and their email address (separate fields). I want to run a macro that collates all the records just for each teacher and sends this to them in an email (ideally as a pdf attachment).

Notes:
I want to send all columns (I have used power query to slim it down to exactly what I want to send so no need to remove any columns).
The numbers of students to teachers varies. Some teachers only have one student, some teachers have about 50.
I am using a proper excel table so efficient and adaptable referencing in VBA is required. (listobjects and header names?)

example of the data:

Student First NameStudent Last nameClassTeacherTeacher emailDate of most recent meetingFormScoreetc
BloggsJoeGladiatorsJames Bjamesb@email.10/10/2017Seers125other stuff
KillyEsspaceGladiatorsJustin Sjustins@email.2/2/2020King101other stuff

Hopefully you get the picture. Looking for James B and Justin S to receive an email with PDF attachment with only their students' info

Ideally sorted by Class, then Last name.

My greatest thanks for looking!
Sej
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet with a little more data. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here (de-sensitized if necessary).
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,846
Members
449,194
Latest member
HellScout

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