Solved

Excel -Show Formula  - Cell Format Wrap?

Posted on 2011-03-21
4
355 Views
Last Modified: 2012-05-11
Hi Experts,

How to Cell format wrap a formula?
I have tried everthing I know,   seems formula does not want to be wrapped.
I want to wrap so that I can print on one sheet. formulas are not wrapping, what gives?
0
Comment
Question by:AndyPandy
4 Comments
 
LVL 24

Accepted Solution

by:
broomee9 earned 500 total points
ID: 35181771
You'd have to make them text for the wrap function to work.  Have a look at this link:

http://www.excelbanter.com/showthread.php?t=188426

Below is the code from the link, to convert to text and then wrap it for printing.
Sub ListFormulas()
'from John Walkenbach
Dim FormulaCells As Range, Cell As Range
Dim FormulaSheet As Worksheet
Dim Row As Integer
Dim ws As Worksheet
' Create a Range object for all formula cells
On Error Resume Next
Set FormulaCells = Range("A1").SpecialCells(xlFormulas, 23)

' Exit if no formulas are found
If FormulaCells Is Nothing Then
MsgBox "No Formulas."
Exit Sub
End If

' Add a new worksheet
Application.ScreenUpdating = False
Set FormulaSheet = ActiveWorkbook.Worksheets.Add
FormulaSheet.Name = "Formulas in " & FormulaCells.Parent.Name

' Set up the column headings
With FormulaSheet
Range("A1") = "Address"
Range("B1") = "Formula"
Range("C1") = "Value"
Range("A1:C1").Font.Bold = True
End With

' Process each formula
Row = 2
For Each Cell In FormulaCells
Application.StatusBar = Format((Row - 1) / FormulaCells.Count, "0%")
With FormulaSheet
Cells(Row, 1) = Cell.Address _
(RowAbsolute:=False, ColumnAbsolute:=False)
Cells(Row, 2) = " " & Cell.Formula
Cells(Row, 3) = Cell.Value
Row = Row + 1
End With
Next Cell

' Adjust column widths
With FormulaSheet.Columns("A:C")
.Cells.WrapText = True
End With
Application.StatusBar = False
End Sub

Open in new window

0
 
LVL 24

Expert Comment

by:jimyX
ID: 35181890
You can add apostrophe ' at the beginning of the formula:

'=DATEDIF('Employee Data...
0
 
LVL 8

Expert Comment

by:wchh
ID: 35185510
You can also change the formula cells to TEXT format...
0
 

Author Closing Comment

by:AndyPandy
ID: 35198179
Thank you for this great solution!
The other suggestions for creating text fields are good for a couple cells, are OK but this was was fanatastic for pages of formulas!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question