Parameter string cannot exceed 255 characters?
Hi,
I was having trouble with a string manipulation function that I wrote in Excel. While it worked fine with some strings, it returned "#VALUE!" errors. Took me hours until I finally figured out what was wrong.
I found out that if you write a custom VBA function in Excel that accepts strings as parameters, the length of the string cannot exceed 255 characters. I tried this simple function:
Code:
Function UC(str As String) As String
UC = UCase(str)
End Function
Then in any cell, type, say uc(Rept("a"),255) returns 255 A's, but uc(Rept("a"),256) would return an error.
And I thought Strings can hold up to 2^31 characters. Is there a workaround to this?