Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Print Preview

Hello,

Could someone please help me modify the macro code below to do the
following:

Instead of outputting the data to a Message Box, I need the output to be
Print Previewed ready for printing.

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plot Area Automatically Expands in Print and Print Preview Myk D. Charts and Charting in Excel 2 March 12th 09 01:41 PM
First page of Excel sheerepeats in print layout or print preview philfrotonda Excel Discussion (Misc queries) 1 July 12th 07 09:28 PM
Print and Print Preview Graphic Moving Resizing 2007/2003 Adam Rayburn Excel Discussion (Misc queries) 0 April 4th 07 04:18 PM
print preview v page break preview SamB Excel Discussion (Misc queries) 0 November 16th 06 05:09 PM
cell borders that I create dont show on print preview or print scott3435 Excel Discussion (Misc queries) 2 April 6th 06 02:37 AM


All times are GMT +1. The time now is 06:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"