Ich möchte innerhalb eines Makros ein Array mit n Zeilen und 3 Spalten definieren, komme dabei allerdings nicht weiter. Die Inhalte des Makros sind vom Typ String.
Wie mache ich das???
Gruss, Manuel Kipke
Ich möchte innerhalb eines Makros ein Array mit n Zeilen und 3 Spalten definieren, komme dabei allerdings nicht weiter. Die Inhalte des Makros sind vom Typ String.
Wie mache ich das???
Gruss, Manuel Kipke
das geht so:
Gruß
Steffen d
Siehe Hilfe zu DIM, REDIM und ARRY für weitere Infos.
Gruß Harald
danke erstmal für deine Hilfe!
Weitere Frage: Ich brauch das Array jetzt allerdings global innerhalb des Scriptcodes eines Userforms. Wenn ich es mit Dim deklariere, meckert er mir beim Redim. Gibt es ne andere Möglichkeit, mein Array global zu deklarieren???
Hier mal der Source des ganzen:
Public ListPoints
Dim v_TopData(3, 1) As String
Private Sub CommandButton1_Click()
If (TextBox1.Text = "") Then
MsgBox ("Bitte geben sie eine Uhrzeit ein")
Else
Sheets("Agenda").Cells(2, 1) = "ü"
Sheets("Agenda").Cells(2, 2) = 1
Sheets("Agenda").Cells(2, 3) = TextBox1.Text
Sheets("Agenda").Cells(2, 4) = "Start"
Sheets("Agenda").Cells(2, 8) = "x"
UserForm1.Hide
Unload UserForm1
End If
End Sub
Private Sub CommandButton2_Click()
Dim s_TOPName As String
Dim s_TOPResponsible As String
Dim s_TOPDuration As String
Dim v_TOP As Variant
Dim v_TOPList() As Variant
MsgBox (ListPoints)
s_TOPName = TextBox2.Text
s_TOPResponsible = TextBox4.Text
s_TOPDuration = TextBox5.Text
ListBox1.AddItem (s_TOPName)
ListPoints = ListPoints + 1
v_TOP = Array(ListPoints, s_TOPName, s_TOPResponsible, s_TOPDuration)
Sheets("Agenda").Cells(ListPoints + 2, 2) = v_TOP(0) + 1
Sheets("Agenda").Cells(ListPoints + 2, 4) = v_TOP(1)
Sheets("Agenda").Cells(ListPoints + 2, 5) = v_TOP(2)
Sheets("Agenda").Cells(ListPoints + 2, 6) = v_TOP(3)
ReDim Preserve v_TopData(3, ListPoints)
End Sub
Gruss, Manuel
Gruß Harald