I need help with VBA. I have a table called tblProducts that I need to export to several Excel files. I need to loop through the table and export the records for each ProductCategory into it's own Excel file. Each file should be named with it's ProductCategory.
For example (using the table example below):
The records for ProductIDs 165729 and 620098 need to be exported into a Excel file named Antibiotic.
The records for ProductIDs 835521 and 911543 need to be exported into a Excel file named NSAID.
The records for ProductID 91752 need to be exported into a Excel file named DIURETIC.
I'm not very good with vba. Does anyone have an example of some vba that can accomplish these goals?
Thank you.
For example (using the table example below):
The records for ProductIDs 165729 and 620098 need to be exported into a Excel file named Antibiotic.
The records for ProductIDs 835521 and 911543 need to be exported into a Excel file named NSAID.
The records for ProductID 91752 need to be exported into a Excel file named DIURETIC.
DateOfService | ProductID | ProductName | ProductStrength | ProductForm | ProductCategory |
Ceftriaxone | 1 GM | VIAL | Antibiotic | ||
Vancomycin | 500 MG | VIAL | Antibiotic | ||
Ibuprofen | 200 MG | TAB | NSAID | ||
Diclofenac | 75 MG | TAB | NSAID | ||
Furosemide | 20 MG | TAB | DIURETIC |
[td]
2/16/2024
[/td][td]165729
[/td][td]
1/31/2024
[/td][td]620098
[/td][td]
4/17/2024
[/td][td]835521
[/td][td]
2/2/2024
[/td][td]911543
[/td][td]
7/3/2024
[/td][td]91752
[/td]I'm not very good with vba. Does anyone have an example of some vba that can accomplish these goals?
Thank you.