Noob Macro question

mattmickle

Board Regular
Joined
Nov 17, 2010
Messages
81
I have a database I've built. In it, I have a report that displays all of the issued equipment for an individual, based on Inputting their last name. Is there a way to build a macro that would cycle through all of the names in my database and print this report for each?
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
9,682
Office Version
2007
Platform
Windows
Adjust your data

Code:
Sub PrintTemplate()
    Set h1 = Sheets("database")
    Set h2 = Sheets("report")
    For i = 2 To h1.Range("A" & Rows.Count).End(xlUp).Row
        h2.Range("B5").Value = h1.Cells(i, "A").Value
        h2.PrintOut
    Next
    MsgBox "Finished printing"
End Sub
 

mattmickle

Board Regular
Joined
Nov 17, 2010
Messages
81
there is a section (under which this post is) that is labeled "Microsoft Access".
 

welshgasman

Well-known Member
Joined
May 25, 2013
Messages
707
there is a section (under which this post is) that is labeled "Microsoft Access".
Correct, however my post about it being an access forum was in response to Dante, who had given you some Excel VBA.
 
Last edited:

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
9,682
Office Version
2007
Platform
Windows
I apologize, I was wrong forum.
 
Last edited:

Forum statistics

Threads
1,085,542
Messages
5,384,321
Members
401,887
Latest member
Somesh

Some videos you may like

This Week's Hot Topics

Top