Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
String Not Longer Than 255 Characters in VBA?
Hello, I'd like to use a macro defining range names in a workbook. For the
purpose of creating the range formula, I make use of a string variable, like this: .... Dim RANGE As String For Each ROW In ROWS RANGE = RANGE & "MySheet!$" & COLUMN & "$" & ROW & "," Next ..... It seems to me there must be an overflow in the variable RANGE, since the name is then not defined correctly if the ROWS array has more than say 20 elements. MY QUESTION: Is a string variable in VBA limited to 255 characters? Or is there any way to declare a string variable longer than that, by explicitly stating its lenght, e.g. 500 characters? Thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
String Not Longer Than 255 Characters in VBA?
The limitation is the Range (that may vary with the version), not the VBA
variable. I can get 1024 characters in a cell in XL2002. This is well discussed on this group. Check Google. Recommend: Assign using the value property: Range("A1").Value = "blah" Read using the Text property: Range("A1").Value = Range("A1").Text & "blah" "Quido" wrote in message ... Hello, I'd like to use a macro defining range names in a workbook. For the purpose of creating the range formula, I make use of a string variable, like this: ... Dim RANGE As String For Each ROW In ROWS RANGE = RANGE & "MySheet!$" & COLUMN & "$" & ROW & "," Next .... It seems to me there must be an overflow in the variable RANGE, since the name is then not defined correctly if the ROWS array has more than say 20 elements. MY QUESTION: Is a string variable in VBA limited to 255 characters? Or is there any way to declare a string variable longer than that, by explicitly stating its lenght, e.g. 500 characters? Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert Leading Characters If String Is Only 7 Characters | Excel Discussion (Misc queries) | |||
Count characters within a string | Excel Worksheet Functions | |||
Sumif text is contained winthin a longer text string in a cell | Excel Worksheet Functions | |||
Binary Numbers longer than 10 characters | Excel Worksheet Functions | |||
frequency of characters within a string | Excel Programming |