Modify Code Creating a Formula List

P

Phil Hageman

This is John Walkenback’s code to make a list of formulas on a worksheet. I would like to modify it as follows
1. Not show the rows where there is no formul
2. In the case where a formula links to another workbook, make all fonts red (three columns
3. Make the “Formula†and “Value†column widths = 4
4. Where columns are not wide enough to display all the text, make row height fit, and wrap

Could someone modify this code
Thanks
Phi

Sub ListFormulas(
'From John Walkenbac
'List formulas, cell addresses and values in a newly created workshee
Dim FormulaCells As Range, Cell As Rang
Dim FormulaSheet As Workshee
Dim Row As Intege

'Create a range object for all formula cell
On Error Resume Nex
Set FormulaCells = Range("A1").SpecialCells(xlFormulas, 23

'Exit if no formulas foun
If FormulaCells Is Nothing The
MsgBox "No Formulas, or the sheet is protected.
Exit Su
End I

'Add a new workshee
Application.ScreenUpdating = Fals
Set FormulaSheet = ActiveWorkbook.Worksheets.Ad
FormulaSheet.Name = "Formulas in " & FormulaCells.Parent.Nam

'Set up the column heading
With FormulaShee
Range("A1") = "Address
Range("B1") = "Formula
Range("C1") = "Value
Range("A1:C1").Font.Bold = Tru
End Wit

'Process each formul
Row =
For Each Cell In FormulaCell
Application.StatusBar = Format((Row - 1) / FormulaCells.Count, "0%"
With FormulaShee
Cells(Row, 1) = Cell.Address(RowAbsolute:=False, ColumnAbsolute:=False
Cells(Row, 2) = " " & Cell.Formul
Cells(Row, 3) = Cell.Valu
Row = Row +
End Wit
Next Cel

'Adjust column width
FormulaSheet.Columns("A:C").AutoFi
Application.StatusBar = Fals
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top