Thema: VBA Array
Einzelnen Beitrag anzeigen
Ungelesen 03.05.11, 17:09   #6
sivro
VB - VBA - Python
 
Benutzerbild von sivro
 
Registriert seit: Feb 2010
Beiträge: 29
Bedankt: 11
sivro ist noch neu hier! | 0 Respekt Punkte
Standard

Also da er ein zweidimensionales Array möchte wäre das wohl die bessere Lösung:

Code:
Option Explicit
Option Base 1

Private Sub zweidimensionales_Array()
Dim astrNamen() As String
Dim lngZeile As Long, lngLZ As Long
Dim intSpalte As Integer

lngLZ = Cells(Rows.Count, 1).End(xlUp).Row
ReDim astrNamen(lngLZ, 2)

For lngZeile = 1 To lngLZ
  For intSpalte = 1 To 2
    astrNamen(lngZeile, intSpalte) = Cells(lngZeile, intSpalte)
  Next intSpalte
Next lngZeile

For lngZeile = LBound(astrNamen) To UBound(astrNamen)
  MsgBox astrNamen(lngZeile, 1) & "   " & astrNamen(lngZeile, 2)
Next lngZeile

Erase astrNamen
End Sub
sivro ist offline   Mit Zitat antworten