# VBA - Range string longer than 255 characters



## OleRasmusen (Dec 21, 2010)

I am using Excel 2007 - I have a lot of rows (>85K). I make a selection using VBA code. However the resulting string containg my range - is longer than 255 characters - this was a limitation in excel 2003. Anyway I can change this limit in Excel 2007. I know the code works as I get no errors when I make a selection that is much smaller (less than 255 characters).

The code generating the error looks like this 

Set myRange = ActiveSheet.Range(Astr)

Where Astr= the range using ',' & ':' as delimiters.



The reason I need it in a single range is that I next use the functions below:

SmpCounter = Application.WorksheetFunction.Count(myRange)
MeanCurr = Application.WorksheetFunction.Average(myRange)
StdCurr = Application.WorksheetFunction.StDev(myRange)
MinCurr = Application.WorksheetFunction.Min(myRange)
MaxCurr = Application.WorksheetFunction.Max(myRange)

I suppose I can write code to replace the excel functions - but would be nice if I could set the range and use it over and over.


----------



## Corday (Mar 3, 2010)

Microsoft workaround is at: Passed strings longer than 255 characters are truncated in Excel


----------



## OleRasmusen (Dec 21, 2010)

Thanks Corday - I will take a crack at that.


----------

