Solved

Excel -Show Formula  - Cell Format Wrap?

Posted on 2011-03-21
4
359 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

856 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