Macro to print a changing report based on lookups

Litmus

New Member
Joined
Mar 14, 2018
Messages
2
I have a different report to print for 80 individuals based on lookups - I am using a single unique identifier to change the data on the report (G1). Here is my very weak macro attempt but it only prints the for first person on the list. How do I make this loop to print the next report and so on...

For I = 1 To 5
Sheets("Data").Select
Range("A1").Select
ActiveCell.Offset(1, 0).Select
Selection.Copy
Sheets("Report").Select
Range("G1").Select
ActiveSheet.Paste
Range("A1:D29").Select
Selection.PrintOut Copies:=1
Next

Any help would be very well received.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Although you are looping 5 times, it appears that you are not using the value of I to make any changes. Perhaps:

ActiveCell.Offset(1, 0).Select
should be
ActiveCell.Offset(I, 0).Select
 
Upvote 0
Thank you that is very helpful - works perfectly.
Perhaps I can ask you another question. The report contains grades - not all pupils do the same subjects, how do I remove rows with no grade? e.g. Art and Business
CourseTypeEquivalencyGrade
Art and DesignGCSEx1 GCSE
BusinessBTECx1 GCSE
Computer ScienceGCSEx1 GCSE
DanceBTECx1 GCSE
DramaGCSEx1 GCSE
DramaRSLx1 GCSE
EngineeringBTECx1 GCSE
English LanguageGCSEx1 GCSE5
English LiteratureGCSEx1 GCSE5
FrenchGCSEx1 GCSE
GeographyGCSEx1 GCSE4
HistoryGCSEx1 GCSE
MathsGCSEx1 GCSE4
Media StudiesBTECx1 GCSEM2
PE/SportBTECx1 GCSEM2
Religious EducationGCSEx1 GCSE7
ScienceGCSEx2 GCSEs3-3
Travel and TourismBTECx1 GCSE

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
There are multiple ways to accomplish this...
One way would be to sort the information by grade, then delete all the rows where there is no grade.

If the original order is important, create an "Original Order" column with sequential numbers. Then after the sort by grade, you could sort by Original Order to get back to the original sort order.
 
Upvote 0

Forum statistics

Threads
1,215,061
Messages
6,122,921
Members
449,094
Latest member
teemeren

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