print form with data from other sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a script for printing form (sheet "PZ") with data from one sheet
(sheet "list") from active cell in sheet "list". And I want to use in this
form also data from another sheet ("projekty") from the same row number as in
sheet "list". But I don't know how...
Can you help me someone. I'm sending the script I tried to use, but it
didn't work.

Sub PrintPZ()
Dim i As Long
Sheets("list").Select
For i = ActiveCell.Row To ActiveCell.Row
Sheets("PZ").Range("C13").Value = Range("C" & i).Value
Sheets("PZ").Range("E32").Value = Sheets("projekty").Range("I" & i).Value
Sheets("PZ").Range("D34").Value = Sheets("projekty").Range("G" & i).Value
Sheets("PZ").PrintOut
End Sub
 
Except for the loop, it looks ok to me:

Sub PrintPZ()
Dim i As Long
Sheets("list").Select
i = ActiveCell.Row
Sheets("PZ").Range("C13").Value = Range("C" & i).Value
Sheets("PZ").Range("E32").Value = Sheets("projekty").Range("I" & i).Value
Sheets("PZ").Range("D34").Value = Sheets("projekty").Range("G" & i).Value
Sheets("PZ").PrintOut preview:=true
End Sub

(preview:=true will save you some trees while you're testing.)
 
Back
Top