creating a User Defined Function may be the easiest:
Function GetFormula(cell)
GetFormula = cell.Formula
End Function
if your formulas are in column A, insert a column at column B, in cell B1 enter =getformula(a1) and copy down.
Not exactly what you're looking for, but may do.
Mark
could also paste the formula and add a ' to the front of it
adding a ' to the front of the formula will let you turn it into a label you could put at the head of the column if that's any use.
Here's a macro I use that for the selected cell(s)toggles between displaying the formulas and the results :-
Sub ToggleFormula()
Dim rng As Range, cell As Range
Set rng = Intersect(ActiveSheet.UsedRange, Selection)
On Error Resume Next
For Each cell In rng
If cell.HasFormula = True Then
cell.Value = Chr(39) & cell.Formula
Else
cell = cell.Value
End If
Next cell
End Sub
If you prefer to have two buttons instead of one, then :-
Sub ShowFormulas() : _
Selection.Replace What:="=", _
Replacement:="""=", _
LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False _
End Sub
Sub HideFormulas : _
Selection.Replace What:="""=", _
Replacement:="=", _
LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False _
End Sub
Hi Raymnond
thanks a lot for the valuable tip
Roger
Re: could also paste the formula and add a ' to the front of it
hi Eric
Thanks a lot for the tip
Roger
hi Mark
thanks a lot for the UDF and for the quick service!!
Roger