"qwopzxnm" wrote:
> .. Max - Your method works great however if I continue to
> add formulas to the worksheet I would need to
> keep repeating this each time. Is there a way to
> automate this so that if I add a formula to a cell it will
> automatically format the text?
Another option to tinker with ..
We could assign the Sub FormatFormulaCells()
below to a shortcut key
(I recorded* a macro as the earlier steps were done manually,
the F5 > Special ..., Format > Cells > Font > dark blue/bold ...
then slightly edited the recorder's output)
*via: Tools > Macro > Record New Macro
To install the sub:
In Excel,
Press Alt+F11 to go to VBE
Click Insert > Module
Copy & paste the sub into the code window
Press Alt+Q to get back to Excel
To assign the sub to a shortcut key:
In Excel,
Press Alt+F8 to bring up the Macro dialog
Select "FormatFormulaCells" > click Options,
then assign a shortcut key, say: Ctrl+k
Click OK, then dismiss the dialog (press Cancel)
Test it out ... in any sheet with formulas,
just press the shortcut combo: Ctrl+k
and all the formula cells in the sheet
would be accordingly formatted (dark blue/bold)
Adapt to suit ..
'-----
Sub FormatFormulaCells()
'Selects & formats formula cells on activesheet
On Error Resume Next
Selection.SpecialCells(xlCellTypeFormulas, 23).Select
Selection.NumberFormat = "0.00"
With Selection.Font
.Name = "Tahoma"
.FontStyle = "Bold"
.ColorIndex = 5 'dark blue
End With
Selection.Interior.ColorIndex = xlNone
End Sub
'----
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
Bookmarks