samedi 28 février 2015

Need VBA code to search multpile datas in a sheet and print the selected data in one page

It would be great if anyone could help me, i need to find various datas in a sheet and select those data and print the selected data to printout and all datas to be printed in one page. i tried with this code but something wrong:-



Sub Selection()
Dim varRow As String

For i = 1 To Range("A" & Rows.Count).End(xlUp).Row
If Range("A" & i).Value = "M655" Or Range("A" & i).Value = "Equity Fund" Then
If Trim(varRow) <> "" Then
varRow = varRow & "," & i & ":" & i
Else
varRow = varRow & i & ":" & i
End If
End If
Next i

Range(varRow).Select


Selection.PrintOut
With ActiveSheet.PageSetup
.PrintTitleRows = "$3:$3"
.PrintTitleColumns = "$B:$B"
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1

End with
End Sub


Kindly help me out.


Thanks & Regards


Aucun commentaire:

Enregistrer un commentaire