Printing Report Card

S

Salza

I am using Excel 2007 to prepare an exam worksheet. Data in SheetA,
Report Card in SheetB.
With validation list, I choose name to get each student's mark in the
report card.
Then I could print the report card. The thing is I have to do this one
by one..that is.. to select one name and print a copy .How do I print
all the report cards at one go. Can someone suggest a macro to do
this? Thanks.
 
R

Roger Govier

Hi

The following should get you started.
Change the ranges to suit where your names a re located on Sheet1, and the
cell where you select the Student name manually on Sheet2

Sub Printcards()
Dim c As Range
Dim wss As Worksheet
Dim wsd As Worksheet

Set wss = ThisWorkbook.Sheets("Sheet1")
Set wsd = ThisWorkbook.Sheets("Sheet2")
' next line assumes Name are in column A starting at row 2
For Each c In wss.Range("A2:A" _
& wss.Range("A65536").End(xlUp).Row)
' change B4 in next line to match the cell where you select Student
Name
wsd.Range("B4").Value = c.Value

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=False
Next
End Sub

--
Regards
Roger Govier

Salza said:
I am using Excel 2007 to prepare an exam worksheet. Data in SheetA,
Report Card in SheetB.
With validation list, I choose name to get each student's mark in the
report card.
Then I could print the report card. The thing is I have to do this one
by one..that is.. to select one name and print a copy .How do I print
all the report cards at one go. Can someone suggest a macro to do
this? Thanks.

__________ Information from ESET Smart Security, version of virus
signature database 4733 (20091231) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 4733 (20091231) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
S

Salza

Hi

The following should get you started.
Change the ranges to suit where your names a re located on Sheet1, and the
cell where you select the Student name manually on Sheet2

Sub Printcards()
    Dim c As Range
    Dim wss As Worksheet
    Dim wsd As Worksheet

    Set wss = ThisWorkbook.Sheets("Sheet1")
    Set wsd = ThisWorkbook.Sheets("Sheet2")
    ' next line assumes Name are in column A starting at row 2
    For Each c In wss.Range("A2:A" _
                            & wss.Range("A65536").End(xlUp).Row)
        ' change B4 in next line to match the cell where you select Student
Name
        wsd.Range("B4").Value = c.Value

        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=False
    Next
End Sub

--
Regards
Roger Govier









__________ Information from ESET Smart Security, version of virus signature database 4733 (20091231) __________

The message was checked by ESET Smart Security.

http://www.eset.com

Thank you, Roger. I will try it in a short while and let you know the
result. Will take me time as I am new to this.
Happy New Year to you
 
D

Don Guillett

I assume you have a remote list of the names.
sub printemall()
for each n in range("b2:b22")
put the data where it goes with this line
activesheet.printout
next n
end sub
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top