Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default show cell reference as text

Greetings:
How to show a cell reference as Text:
Example:
Cell C3: Has input of =+G12, Shows value of 236

Cell D3: Need to "extract" the cell reference used in C3.
To show as text. Should read G12

As per instructions found in ng (if I'm reading it correctly):
In cell D3, I entered =ws(C3)
I then copy and paste the code in a new module, in the workbook.

Function ws(rg As Range) As String
If InStr(1, rg.Formula, "!") 0 Then
ws = Mid(rg.Formula, 2, InStr(1, rg.Formula, "!") - 2)
End If
End Function
Back to my spread-sheet, Cell D3 reads =ws(C3).
It does NOT read G12, as I expected.

I have a feeling I'm overlooking something VERY obvious here,
but I can't seem to get a handle on it.
Help, please.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default show cell reference as text

There is a problem with th original code. It will only return a value if the
reference is on another worksheet. try this change

Function ws(rg As Range) As String
If InStr(1, rg.Formula, "!") 0 Then
ws = Mid(rg.Formula, 2, InStr(1, rg.Formula, "!") - 2)
else
ws = Mid(rg.Formula, 2, len(rg.Formula))
End If
End Function

"BEEJAY" wrote:

Greetings:
How to show a cell reference as Text:
Example:
Cell C3: Has input of =+G12, Shows value of 236

Cell D3: Need to "extract" the cell reference used in C3.
To show as text. Should read G12

As per instructions found in ng (if I'm reading it correctly):
In cell D3, I entered =ws(C3)
I then copy and paste the code in a new module, in the workbook.

Function ws(rg As Range) As String
If InStr(1, rg.Formula, "!") 0 Then
ws = Mid(rg.Formula, 2, InStr(1, rg.Formula, "!") - 2)
End If
End Function
Back to my spread-sheet, Cell D3 reads =ws(C3).
It does NOT read G12, as I expected.

I have a feeling I'm overlooking something VERY obvious here,
but I can't seem to get a handle on it.
Help, please.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default show cell reference as text

This function seems to work also...

Function ws(rg As Range) As String
ws = Replace(Replace(Mid(rg.Formula, 1 + _
InStr(1, rg.Formula, "!")), "=", ""), "+", "")
End Function

Rick


"Joel" wrote in message
...
There is a problem with th original code. It will only return a value if
the
reference is on another worksheet. try this change

Function ws(rg As Range) As String
If InStr(1, rg.Formula, "!") 0 Then
ws = Mid(rg.Formula, 2, InStr(1, rg.Formula, "!") - 2)
else
ws = Mid(rg.Formula, 2, len(rg.Formula))
End If
End Function

"BEEJAY" wrote:

Greetings:
How to show a cell reference as Text:
Example:
Cell C3: Has input of =+G12, Shows value of 236

Cell D3: Need to "extract" the cell reference used in C3.
To show as text. Should read G12

As per instructions found in ng (if I'm reading it correctly):
In cell D3, I entered =ws(C3)
I then copy and paste the code in a new module, in the workbook.

Function ws(rg As Range) As String
If InStr(1, rg.Formula, "!") 0 Then
ws = Mid(rg.Formula, 2, InStr(1, rg.Formula, "!") - 2)
End If
End Function
Back to my spread-sheet, Cell D3 reads =ws(C3).
It does NOT read G12, as I expected.

I have a feeling I'm overlooking something VERY obvious here,
but I can't seem to get a handle on it.
Help, please.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default show cell reference as text

Joel:
Thanks for the prompt response.
However, I still can't get it to work.
As indicated before, Cell D3 still shows =ws(C3) and not G12, as expected
Any other ideas?

"Joel" wrote:

There is a problem with th original code. It will only return a value if the
reference is on another worksheet. try this change

Function ws(rg As Range) As String
If InStr(1, rg.Formula, "!") 0 Then
ws = Mid(rg.Formula, 2, InStr(1, rg.Formula, "!") - 2)
else
ws = Mid(rg.Formula, 2, len(rg.Formula))
End If
End Function

"BEEJAY" wrote:

Greetings:
How to show a cell reference as Text:
Example:
Cell C3: Has input of =+G12, Shows value of 236

Cell D3: Need to "extract" the cell reference used in C3.
To show as text. Should read G12

As per instructions found in ng (if I'm reading it correctly):
In cell D3, I entered =ws(C3)
I then copy and paste the code in a new module, in the workbook.

Function ws(rg As Range) As String
If InStr(1, rg.Formula, "!") 0 Then
ws = Mid(rg.Formula, 2, InStr(1, rg.Formula, "!") - 2)
End If
End Function
Back to my spread-sheet, Cell D3 reads =ws(C3).
It does NOT read G12, as I expected.

I have a feeling I'm overlooking something VERY obvious here,
but I can't seem to get a handle on it.
Help, please.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default show cell reference as text

Joel:
I don't know what I did, but just "bouncing" off and on Cell D3, and all of
a sudden it worked.
Rick R:
For education purposes I will yet work with your submission, as well.
Thank-you

Now for the next step. I hope you can help with this, as well.
In cell C13, I have entered: =OFFSET(INDIRECT,("D3"),,1).
It returns #NAME?. I presume it is somehow NOT picking up the cell
reference, out of Cell D3, namely G12. Do you have any magic to work on this
one?




"BEEJAY" wrote:

Joel:
Thanks for the prompt response.
However, I still can't get it to work.
As indicated before, Cell D3 still shows =ws(C3) and not G12, as expected
Any other ideas?

"Joel" wrote:

There is a problem with th original code. It will only return a value if the
reference is on another worksheet. try this change

Function ws(rg As Range) As String
If InStr(1, rg.Formula, "!") 0 Then
ws = Mid(rg.Formula, 2, InStr(1, rg.Formula, "!") - 2)
else
ws = Mid(rg.Formula, 2, len(rg.Formula))
End If
End Function

"BEEJAY" wrote:

Greetings:
How to show a cell reference as Text:
Example:
Cell C3: Has input of =+G12, Shows value of 236

Cell D3: Need to "extract" the cell reference used in C3.
To show as text. Should read G12

As per instructions found in ng (if I'm reading it correctly):
In cell D3, I entered =ws(C3)
I then copy and paste the code in a new module, in the workbook.

Function ws(rg As Range) As String
If InStr(1, rg.Formula, "!") 0 Then
ws = Mid(rg.Formula, 2, InStr(1, rg.Formula, "!") - 2)
End If
End Function
Back to my spread-sheet, Cell D3 reads =ws(C3).
It does NOT read G12, as I expected.

I have a feeling I'm overlooking something VERY obvious here,
but I can't seem to get a handle on it.
Help, please.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default show cell reference as text

Rick R:
For education purposes I will yet work with your submission, as well.


If you have any questions about the code, feel free to ask.

Rick
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
Show cell reference as text tjc Excel Discussion (Misc queries) 6 August 31st 07 03:50 PM
Show Cell Reference CJ Excel Worksheet Functions 6 October 18th 06 09:22 PM
Show values in formula instead of cell reference pnorgate Excel Worksheet Functions 6 August 20th 06 09:31 AM
Formula to show zero if reference cell is zero? tricky! Simon Lloyd Excel Worksheet Functions 3 June 13th 06 11:31 PM
help to show formart in reference cell jiang Excel Worksheet Functions 4 November 23rd 04 03:29 PM


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

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"