Link to home
Start Free TrialLog in
Avatar of Frank Freese
Frank FreeseFlag for United States of America

asked on

Output the Immediate window to printer or screen

Folks,
I would like to add to the below code after the End Width the ability for the user to look at the  Immediate window and then elect to print out those results with the use of a MsgBox
?
Sub DocFormulaWks()
Dim rng As Range

With ActiveSheet
    For Each rng In .UsedRange
        If rng.HasFormula = True Then
        Debug.Print "Addr.: " & rng.Address
        Debug.Print "Form.: " & rng.Formula
        Debug.Print "Value : " & rng.Value
    End If
 Next rng
 End With
 End Sub

Open in new window

Avatar of Martin Liss
Martin Liss
Flag of United States of America image

The Immediate Window isn't functional except when debugging/developing.
SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Frank Freese

ASKER

OK - so the output to the Immediate Window can not be sent to a printer but the data could. In the submitted code what would that look like, please.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Like this?
Sub DocFormulaWks()			
Dim rng As Range			
			
With ActiveSheet			
    For Each rng In .UsedRange			
        If rng.HasFormula = True Then			
        Printer.Print "Addr.: " & rng.Address			
        Printer.Print "Form.: " & rng.Formula			
        Printer.Print "Value : " & rng.Value			
       Printer.EndDoc			
    End If			
 Next rng			
 End With			
End Sub			

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks - I guess this is why they pay you the "big" bucks for people like me. As always, I appreciate you
great job!
YW and thanks for the kind words.

Marty - MVP 2009 to 2013
Avatar of [ fanpages ]
[ fanpages ]

thanks - I guess this is why they pay you the "big" bucks for people like me. As always, I appreciate you

When did the "Experts" get paid for providing answers to questions?

Am I missing out? ;)