macros that turn on/off formulas in sheets

  • Thread starter Thread starter beccy_rafty
  • Start date Start date
B

beccy_rafty

:confused: I have set up a workbook with 6 worksheets. I now need t
create a macro that will display all the formulas used in thes
worksheets and then anpther macro that eill turn them off.

I know how to do it for a single cell. However I am very confused abou
the code I would need to write in order to turn them on and off fo
multiply sheets.

I have thought long and hard and am still greatly confused about this
Could anyone please help!!!!!!!!
 
Hi,
Try these macros


Sub view_formulas()
sn = ActiveSheet.Name
rn = ActiveCell.Address
For Each ss In ActiveWorkbook.Worksheets
ss.Select
ActiveWindow.DisplayFormulas = True
Next
Application.Goto Reference:=Sheets(sn).Range(rn)
End Sub

Sub hide_formulas()
sn = ActiveSheet.Name
rn = ActiveCell.Address
For Each ss In ActiveWorkbook.Worksheets
ss.Select
ActiveWindow.DisplayFormulas = False
Next
Application.Goto Reference:=Sheets(sn).Range(rn)
End Su
 
try this for starters

As you can do what you want to with one cell you should be able to
modify what you want to do.

I have included examples of dealing with 1 cel, multiple cells & all
cells.

Code can also be modified to use rows or columns



Sub fff()
Dim Ws As Worksheet

For Each Ws In Worksheets
'do something
Debug.Print Ws.Name
Ws.Range("a1:c5").Font.ColorIndex = 3 ' multiple cells
'or
Ws.Cells(1, 1).Font.ColorIndex = 5 ' single cell
'or
Ws.Range("b6").Font.ColorIndex = 5 ' single cell

' or
Ws.Cells.Font.ColorIndex = 7 ' all cells

Next Ws
End Sub
 
Back
Top