I have the following UDF, which I'm sure I got from somewhere here, that returns the sheet name.
Public Function SheetInfo(optWanted As Byte) As String
Select Case optWanted
Case 1
SheetInfo = ActiveSheet.Name
Case 2
SheetInfo = ThisWorkbook.Name
Case 3
SheetInfo = ThisWorkbook.FullName
End Select
End Function
The problem is that when I try to use the FIND() function in a cell, say to look for the position of a hyphen in the name, I get a #VALUE error. I can use other string functions, for example LEFT(Sheetinfo(1),1) successfully returns the leftmost character. However, ultimately I'm looking to capture the LEFT [x] number of characters from a hyphen and separately the RIGHT [x] characters from this string.
What am I missing? Thanks...Wayne
Public Function SheetInfo(optWanted As Byte) As String
Select Case optWanted
Case 1
SheetInfo = ActiveSheet.Name
Case 2
SheetInfo = ThisWorkbook.Name
Case 3
SheetInfo = ThisWorkbook.FullName
End Select
End Function
The problem is that when I try to use the FIND() function in a cell, say to look for the position of a hyphen in the name, I get a #VALUE error. I can use other string functions, for example LEFT(Sheetinfo(1),1) successfully returns the leftmost character. However, ultimately I'm looking to capture the LEFT [x] number of characters from a hyphen and separately the RIGHT [x] characters from this string.
What am I missing? Thanks...Wayne