ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Formular of one cell as text shown in another cell (https://www.excelbanter.com/excel-discussion-misc-queries/106295-formular-one-cell-text-shown-another-cell.html)

dan

Formular of one cell as text shown in another cell
 
Suppose Cell B3 has a formular =Start!C3.
I would want Cell D3 to have the text '=Start!C3 entered.
It can be in formular or in VBA code.
Thank you



Niek Otten

Formular of one cell as text shown in another cell
 
' =======================================
Function ShowFormula(a As Range)
' Niek Otten
' March 31, 2006

If Application.ReferenceStyle = xlR1C1 _
Then ShowFormula = a.FormulaR1C1Local _
Else: ShowFormula = a.FormulaLocal
End Function
' =======================================

================================================
Pasting a User Defined Function (UDF)
Niek Otten, March 31, 2006

If you find a VBA function on the Internet or somebody mails you one, and you don't know how to implement it, follow these
steps:

Select all the text of the function.
CTRL+C (that is, press and hold down the CTRL key, press C, release both). This a shortcut for Copy.
Go to Excel. Press ALT+F11 (same method: press and hold the ALT key, press the F11 key and release both). You are now in the
Visual Basic Editor (VBE).
From the menu bar, choose InsertModule. There should now be a blank module sheet in front of you. Click in it and then
press CTRL+V (same method.). This a shortcut for Paste. You should now see the text of the function in the Module.
Press ALT+F11 again to return to your Excel worksheet.
You should now be able to use the function as if it were a built-in function of Excel, like =SUM(..)
================================================



--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"dan" wrote in message news:6VqGg.5598$6s.5296@trndny08...
| Suppose Cell B3 has a formular =Start!C3.
| I would want Cell D3 to have the text '=Start!C3 entered.
| It can be in formular or in VBA code.
| Thank you
|
|



dan

Formular of one cell as text shown in another cell
 
This is great!
Thank you very much, Niek

"Niek Otten" wrote in message
...
' =======================================
Function ShowFormula(a As Range)
' Niek Otten
' March 31, 2006

If Application.ReferenceStyle = xlR1C1 _
Then ShowFormula = a.FormulaR1C1Local _
Else: ShowFormula = a.FormulaLocal
End Function
' =======================================

================================================
Pasting a User Defined Function (UDF)
Niek Otten, March 31, 2006

If you find a VBA function on the Internet or somebody mails you one,
and you don't know how to implement it, follow these
steps:

Select all the text of the function.
CTRL+C (that is, press and hold down the CTRL key, press C, release
both). This a shortcut for Copy.
Go to Excel. Press ALT+F11 (same method: press and hold the ALT key,
press the F11 key and release both). You are now in the
Visual Basic Editor (VBE).
From the menu bar, choose InsertModule. There should now be a blank
module sheet in front of you. Click in it and then
press CTRL+V (same method.). This a shortcut for Paste. You should now see
the text of the function in the Module.
Press ALT+F11 again to return to your Excel worksheet.
You should now be able to use the function as if it were a built-in
function of Excel, like =SUM(..)
================================================



--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"dan" wrote in message
news:6VqGg.5598$6s.5296@trndny08...
| Suppose Cell B3 has a formular =Start!C3.
| I would want Cell D3 to have the text '=Start!C3 entered.
| It can be in formular or in VBA code.
| Thank you
|
|






All times are GMT +1. The time now is 10:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com