LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Convert a range t ype to a string type

Thanks for the quick reply! But...

Yeah - that would make it a string. But I'd like to make it a clickable
range so the user can enter "=sheetname(" then click on the cell for the
reference.

--
Adios,
Clay Harryman


"Joel" wrote:

You forgot th edouble quotes

=sheetname("Sheet1!A1")


"Clayman" wrote:

It's two - two - two questions in one!

I am writing a formula to extract the sheet name from a cell reference.
Here's my code:

Function sheetname(sell As String) As String
exclpoint = InStr(sell, "!")
sheetname = Left$(sell, exclpoint - 1)
End Function

I've tested this code in the following sub and it worked:

Private Sub cheetname()
sell = "Sheet1!A1"
exclamationpoint = InStr(sell, "!")
thename = Left$(sell, exclamationpoint - 1)
okeedokee = MsgBox(thename, vbOKOnly)
End Sub

But the function gives me a #NAME? error. So, my thinking is that I need to
define this as a range instead of a string. But how do I convert the range
type to a string?

Or, is the #NAME? error 'cuz I'm not calling the formula correctly?
=sheetname(Sheet1!A1)
--
Adios,
Clay Harryman

 
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
[VBA] Convert string to Range Denis[_7_] Excel Programming 3 November 30th 06 06:03 PM
convert a string to range? JK Excel Worksheet Functions 4 June 20th 06 01:04 AM
Convert string to range? k Excel Programming 4 April 9th 04 09:03 PM
Convert String of 512 numbers to a range Kevin G[_2_] Excel Programming 10 February 2nd 04 06:02 AM


All times are GMT +1. The time now is 12:41 PM.

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

About Us

"It's about Microsoft Excel"