![]() |
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 |
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 |
All times are GMT +1. The time now is 05:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com