PDA

View Full Version : Solved: print code



neditheg
12-13-2010, 02:30 AM
hello,

I need a code to print an excel file.
I want to print the data from the first sheet named "DP" ...the cells B8 and A18 ..must change and take the data from the 2nd sheet named "fisier_casa_nov2010".


PLS help!!

thanks!!

Bob Phillips
12-13-2010, 03:15 AM
Public Sub PrintSheets()
Dim LastRow As Long
Dim i As Long

With Worksheets("FISIER CASA_NOIEMB 2010")

LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = 7 To LastRow

Worksheets("DP").Range("A18").Value = .Cells(i, "B").Value
Worksheets("DP").Range("B8").Value = .Cells(i, "C").Value
Worksheets("DP").PrintOut
Next i
End With
End Sub

neditheg
12-13-2010, 03:29 AM
10x!!

I think I love you!! :)

thanks a lot!!