LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.misc
TUNGANA KURMA RAJU
 
Posts: n/a
Default Printing formulas

A million Thanks to Dave Peterson.You really made my day.Your code worked
perfectly,the way what I need.Thanks once again

"Dave Peterson" wrote:

There was a slight bug in Bob's original code. If the Formulas worksheet didn't
exist, then when the code added that sheet, it became the activesheet. And
there were no formulas on that sheet--so nothing got done.

Option Explicit
Sub PrintFormulas2()
Dim cell As Range
Dim sh As Worksheet
Dim curSh As Worksheet
Dim i As Long

Set curSh = ActiveSheet

On Error Resume Next
Set sh = Worksheets("Formulas")
On Error GoTo 0
If sh Is Nothing Then
Set sh = Worksheets.Add
sh.Name = "Formulas"
Else
sh.Cells.ClearContents
End If

sh.Range("a1").Resize(1, 2).Value = Array("Address", "Formula")

i = 1
For Each cell In curSh.UsedRange
If cell.HasFormula Then
i = i + 1
sh.Cells(i, "A").Value = cell.Address(False, False)
sh.Cells(i, "B").Value = "'" & cell.Formula
End If
Next cell

With sh
.Activate
.Range("b:b").EntireColumn.ColumnWidth = 94
.Range("b:b").WrapText = True
.Rows.AutoFit
End With

End Sub

When you want to tweak code, you can get a lot of the basics by just recording
code when you do it manually. (It can be quicker than asking a followup.)

TUNGANA KURMA RAJU wrote:

Mr.Bob Philips,
Though I am late,I tested your code and really it is very good.I have one
query abouut this code.Am I to run this code twice?.When I first run this
code It has inserted "Formulas" sheet first.second time when I run this code
all formulas with address dumped into this formulas sheet.Is this two stepped
code?
secondly I am facing a problem with this code.While printing this "Formulas"
sheet many of my formulas have truncated,as they are very large(most of them
are more than 250 characters).Will you please modify that last line of your
code so that column B:B width b= 94 and all cells format in column B:B
=wraptext format =true.
and I would like to add column name"Address" for col A and "Formula" to
column B

"Bob Phillips" wrote:

You could just dump them all to a new worksheet and print that

Sub PrintFormulas()
Dim cell As Range
Dim sh As Worksheet
Dim i As Long

On Error Resume Next
Set sh = Worksheets("Formulas")
On Error GoTo 0
If sh Is Nothing Then
Set sh = Worksheets.Add
sh.Name = "Formulas"
Else
sh.Cells.ClearContents
End If
For Each cell In ActiveSheet.UsedRange
If cell.HasFormula Then
i = i + 1
sh.Cells(i, "A").Value = cell.Address(False, False)
sh.Cells(i, "B").Value = "'" & cell.Formula
End If
Next cell
sh.Activate
sh.Columns("B:B").AutoFit
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"TUNGANA KURMA RAJU" wrote in
message ...
I have 5 work sheets in a BOOK,each sheet a2:m30, every cell contains
formula.Iwould like to keep a hard copy of these formulas I have used.In
Toolsoptionsview tab I have checked formulas,but these formulas wrap
each
other by which I can't print these formulas.Is there any way to print all
these formulas at one go.




--

Dave Peterson

 
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
Printing Excel Formulas without file paths updating Kim Excel Discussion (Misc queries) 0 August 18th 05 04:55 PM
Array Formulas take waaaay too long... belly0fdesire Excel Worksheet Functions 7 August 8th 05 10:11 PM
Problem with named formula's nathan Excel Worksheet Functions 0 January 21st 05 04:07 PM
In Exel 2000, stop the blank cells (with formulas) from printing. tonyoc Excel Discussion (Misc queries) 1 December 10th 04 12:38 AM
calculating formulas for all workbooks in a folder Chad Excel Worksheet Functions 3 November 13th 04 05:22 PM


All times are GMT +1. The time now is 04:55 PM.

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

About Us

"It's about Microsoft Excel"