We have an application written in Excel 2002 VBA that deals with
user-selected cells. The user does not select the cells in any specific
order, nor does he select them from a single column as in this case. However,
the cells must be processed in exact row/column order. We have therefor
sorted the selected cells
in that order and are now about to combine them to a Range using the
Dim rngSel As Range
Dim strRange As String
Set rngSel = Worksheets("Lines").Range(strRange)
' strRange contains the following list of cells, which are
selected by the
user. In this case some of them are
' in a contiguous range:
4,U55,U56,U57,U58,U59,U60,U61,U62,U63,U64,U66,U66, U67,U68,U69,U70,U71,U72,U73,U74,U77,U76,U77,U78,U7 9,U80"
"Set Range" statement fails with message: "1004 - Method 'Range' of
object '_Global' failed".
However, if "strRange" only holds up to 65 single cell-addreses, the code
executes correct. But as soon there are 66
or more, it fails with the above error message.
(In this particular case we could set the "strRange" to "U4:U80", but that
would not help, as the user could instead
select cells such as: "B2,C3,D4,E7,D8,B9,F10.....etc.").
We have not been able to find any documentation on a
limitation in the
number of individual cells you can specify in order to form a Range.
I hope someone can help ?