Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
superchica
 
Posts: n/a
Default Display excel formula on worksheet

How do I display only one formula on an Excell worksheet without showing all
of the formulas on my worksheet?
  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Hi superchica

You can use this function in a normal module

Function GETFORMULA(cell As Range) As String
'=GETFORMULA(A1) in a sheet for example
'Various but especially Dave Peterson and Dave McRitchie
Dim myFormula As String
Dim myAddress As String
GETFORMULA = ""
With cell.Cells(1)
'Grab Formulas first
If .HasFormula Then
'Note that we have R1C1 or A1 reference possibilities
If Application.ReferenceStyle = xlA1 Then
myFormula = .Formula
myAddress = cell.Address(0, 0, xlA1)
Else
myFormula = .FormulaR1C1
myAddress = cell.Address(, , xlR1C1)
End If
'Insert prefix "{" and post fix "}" for array formulas
If cell.HasArray Then
GETFORMULA = myAddress & ": {=" & _
Mid(myFormula, 2, Len(myFormula)) & "}"
Else
GETFORMULA = myAddress & ": " & myFormula
End If
Else
'Bog standard data entries
If Application.ReferenceStyle = xlA1 Then
myFormula = cell.Formula
myAddress = cell.Address(0, 0, xlA1)
Else
myFormula = cell.FormulaR1C1
myAddress = cell.Address(, , xlR1C1)
End If
GETFORMULA = myAddress & ": " & myFormula
End If
End With
End Function

And this in a worksheet cell for the formula that is in A1
=GETFORMULA(A1)


--
Regards Ron de Bruin
http://www.rondebruin.nl


"superchica" wrote in message ...
How do I display only one formula on an Excell worksheet without showing all
of the formulas on my worksheet?



  #3   Report Post  
David McRitchie
 
Posts: n/a
Default

To just see it, look at the formula bar with the cell selected.

If you will be printing it see
http://www.mvps.org/dmcritchie/excel...htm#getformula
installation instructions in
http://www.mvps.org/dmcritchie/excel/getstarted.htm
usage on the worksheet, depending on where you installed, any of
=GetFormula(G3)
=personal.xls!GetFormula(G3)
If it is not obvious where the formula actually is you might instead use
=personal.xls!GetFormulaD(G3)

Look over the rest of the web page, there are formulas to obtain
the formatting in another cell, and a heck of a lot more.

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"superchica" wrote...
How do I display only one formula on an Excell worksheet without showing all
of the formulas on my worksheet?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
Display answer only in another cell of one containing a formula Mally Excel Discussion (Misc queries) 5 January 21st 05 01:07 PM
Excel: To Display Formula in the cells Instead of Value [email protected] Excel Discussion (Misc queries) 1 December 10th 04 09:48 PM
Paste is is copying in formula, but display is wrong. Matt Excel Discussion (Misc queries) 2 December 7th 04 08:37 PM
Display selected rows from one worksheet to another Brian Excel Worksheet Functions 5 October 29th 04 12:26 PM


All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"