![]() |
Modify Code Creating a Formula List
This is John Walkenbacks 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 |
All times are GMT +1. The time now is 01:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com