print with data

I

ims

Dear all,

I've a worksheet

A B C D
Date 3.1.03 David
Name 4.1.03 Tom
6.1.03 Mary
8.1.03 Roy

The printing area is A1:B2
B1=C1 and B2=D1 for the first printout
B1=C2 and B2=D2 for the second printout
and so on.....

How can I do this?

thanks

ims
 
P

Patrick Molloy

This procedure should help:

Sub Output()
Dim rw As Long
'set row to first row of data
rw = 1
Do Until Cells(rw, "C") = ""
Range("B1").Calue = Cells(rw, "C")
Range("B2").Calue = Cells(rw, "D")
ActiveSheet.Print
rw = rw + 1 ' next row
Loop
End Sub

Patrick Molloy
Microsoft Excel MVP
 
D

DavidP

This macro should do the trick

Sub PrintData()
Dim Counter As Integer

Application.ScreenUpdating = False

ActiveSheet.PageSetup.PrintArea = "$A$1:$B$2"

Do
Range("B1") = Range("C1").Offset(Counter, 0)
Range("B2") = Range("C1").Offset(Counter, 1)
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Counter = Counter + 1
Loop Until ActiveCell.Offset(X, 0) = ""

Application.ScreenUpdating = True

End Sub


DavidP
 
I

ims

It works, thanks a lot.

ims
'

DavidP said:
This macro should do the trick

Sub PrintData()
Dim Counter As Integer

Application.ScreenUpdating = False

ActiveSheet.PageSetup.PrintArea = "$A$1:$B$2"

Do
Range("B1") = Range("C1").Offset(Counter, 0)
Range("B2") = Range("C1").Offset(Counter, 1)
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Counter = Counter + 1
Loop Until ActiveCell.Offset(X, 0) = ""

Application.ScreenUpdating = True

End Sub


DavidP
 

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