|
-
Jul 9th, 2003, 11:01 AM
#1
Thread Starter
New Member
Thanks alex_read, your code works fine in my Excel (XP) as well. but if I write up another string-manipulating function in VBA and call the function from within a cell using "A1" (the result of Change1To2()) as parameter, I'd get the same result.
It appears that this limitation only applies to custom VBA functions called within cells. There is no such problem if you use Excel's built-in function or call your custom function from within the code (like your example).
I gave "A1" another try with another simple function:
VB Code:
Function Length(str As String) As Long
' If Len(Str) > 255 Then MsgBox "String too long"
Length = Len(str)
End Function
Then I compared Excel's built-in Len() function with my Length(), which is supposed to yield the same result.
In cell #1 I typed "=len(A1)" ==> returned "300"
And in cell 2 I entered "=length(A1)" ==> returned "#VALUE!"
Even if I uncommented the If statement I'd still get "#VALUE!" without any message box. The function simply won't run with >255 strings.
Is this a common issue or is it just me?
P.S. For my purpose, I need to run my function from cells.
Last edited by jute; Jul 9th, 2003 at 11:18 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|