Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print Preview Help
Hello, Could some please help me create the output of the following code to a Print Preview. At the moment it outputs to a MessageBox. Any help with this modification would be greatly appreciated. Kind regards, Chris. Below are some of the main explanations of some of the variables used in the macro: This macro works fine and uses an advanced filter based on a range of values on my worksheet named: Filter. Range: Filter_Data =Offset('SA Register'!$A$2,0,0,COUNTA('SA Register"!$E$3:$E$65536),13) This range selects the entire range of 13 columns from A2 till the end. The are no blank cells in column E. Find_Code =Lookup!$B$2 (user enters a 9-digit number on the worksheet named: Lookup) Find_Rec =Lookup!$B$3 (user selects a value from a drop down list on the worksheet named: Lookup) Range: Data =Offset('SA Register'!$A$3,0,0,COUNTA('SA Register"!$E$3:$E$65536),13) This range selects the entire range of 13 columns till the end. There are no blank cells in column E. It also selects the header row (row 2). This is the macro code: Sub Show_Data() 'Show_Data Macro ' ' ' Dim rw As Integer Dim txt As String If IsEmpty(Range("find_code").Value) Or IsEmpty(Range("find_rec").Value) Then MsgBox "Please fill values" Range("find_code").Select Exit Sub End If With Sheets("SA Register").Range("A2") For rw = 1 To Range("data").Rows.Count Debug.Print .Offset(rw, 3).Value If (.Offset(rw, 4).Value = Range("find_code").Value) And _ (.Offset(rw, 5).Value = Range("find_rec").Value) Then txt = .Offset(0, 0).Value & " : " & .Offset(rw, 0).Value & vbNewLine & _ .Offset(0, 1).Value & " : " & .Offset(rw, 1).Value & vbNewLine & _ .Offset(0, 2).Value & " : " & .Offset(rw, 2).Value & vbNewLine & _ .Offset(0, 3).Value & " : " & .Offset(rw, 3).Value & vbNewLine & _ .Offset(0, 4).Value & " : " & .Offset(rw, 4).Value & vbNewLine & _ .Offset(0, 5).Value & " : " & .Offset(rw, 5).Value & vbNewLine & _ .Offset(0, 6).Value & " : " & .Offset(rw, 6).Value & vbNewLine & _ .Offset(0, 7).Value & " : " & .Offset(rw, 7).Value & vbNewLine & _ .Offset(0, 8).Value & " : " & .Offset(rw, 8).Value & vbNewLine & _ .Offset(0, 9).Value & " : " & .Offset(rw, 9).Value & vbNewLine & _ .Offset(0, 10).Value & " : " & .Offset(rw, 10).Value & vbNewLine & _ .Offset(0, 11).Value & " : " & .Offset(rw, 11).Value & vbNewLine & _ .Offset(0, 12).Value & " : " & .Offset(rw, 12).Value & vbNewLine MsgBox txt End If Next End With End Sub *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Plot Area Automatically Expands in Print and Print Preview | Charts and Charting in Excel | |||
First page of Excel sheerepeats in print layout or print preview | Excel Discussion (Misc queries) | |||
Print and Print Preview Graphic Moving Resizing 2007/2003 | Excel Discussion (Misc queries) | |||
print preview v page break preview | Excel Discussion (Misc queries) | |||
cell borders that I create dont show on print preview or print | Excel Discussion (Misc queries) |