Lösung array to range, range to array
21.12.2010 20:33:27
Andi
Hallo hier anbei die Antwort. :-D
Tatsächlich ein Bug.
Renee, Danke für den Link.
Rudi, der Link deckt sich inhaltlich mit Zeichenanzahl 18...von Dir.
Danke, jetzt weiss ich, dass es nicht an meinem quick and dirty liegt.
Zitat:
Der kuriose Bug mit der Anzahl Zeichen in einem Array
When you run a Microsoft Visual Basic for Applications (VBA) macro to transfer data from a VBA array that contains strings of data to a range of cells in Microsoft Excel 2000 or in Microsoft Excel 2002, the data may be truncated (cut off).
Note
In Microsoft Office Excel 2003, you may receive the following error message when you run the VBA macro in the Visual Basic Editor:
Run-time error '1004':
Application-defined or object-defined errorr
If you run the VBA macro from your Excel worksheet (on the Tools menu, point to Macro and then click Macros), you may receive the following error message:
Microsoft Visual Basic: 400
This problem may occur when the VBA array is longer than 1,823 characters in length.
To work around this problem, populate each cell in your worksheet one at a time from the array, instead of populating the whole range at one time. To do this, use a VBA macro that is similar to the following example:
Sub PopulateRangeWithArray()
Dim x
ReDim x(1 To 2, 1 To 2)
x(1, 1) = String(2000, "a"): x(1, 2) = String(5000, "b")
x(2, 1) = String(17000, "c"): x(2, 2) = String(33000, "d")
MsgBox Len(x(1, 1)) & "," & Len(x(1, 2)) & "," & Len(x(2, 1)) & "," & Len(x(2, 2))
Range("a1").Value = x(1, 1)
Range("b1").Value = x(1, 2)
Range("a2").Value = x(2, 1)
Range("b2").Value = x(2, 2)
End Sub
Weitere Informationen über diesen Bug finden Sie hier:
XL2000/2002/2003: Data May Be Truncated After 1,835 Characters When You Transfer Array Data to Cells in an Excel Worksheet
http://support.microsoft.com/?scid=kb;en-us;832136
Ein interessanter, noch nicht behobener Bug in Microsoft Excel (Stand 22.07.2004).