ich hatte vor ca. einer Woche schon einmal hier im Forum nachgefragt, ob mir jemand bei einem Code helfen könnte, der es mit ermöglicht, durch einen Makroklick, einen neuen Eintrag in einer Liste anzulegen. Leider hab ich irgendwann keine Antworten mehr bekommen :/ Hoffe ihr könnt mir hier noch weiterhelfen.
Das ist der Code, den ich bekommen hatte:
Option Explicit
Sub Main()
Dim lngLastRow As Long
Dim strTMP As String
On Error GoTo Fin
With Tabelle1
lngLastRow = .Cells(.Rows.Count, 2).End(xlUp).Row
strTMP = Split(Split(.Cells(lngLastRow, 2).Value, "(")(1), ")")(0)
If Left(strTMP, 2) = "00" Then
strTMP = "00" & strTMP + 1
ElseIf Left(strTMP, 1) = 0 Then
strTMP = "0" & strTMP + 1
Else
strTMP = strTMP + 1
End If
If Len(strTMP) > 3 Then strTMP = Right(strTMP, 3)
.Cells(lngLastRow + 1, 2).Value = "(" & strTMP & ")_ "
Application.Goto .Cells(lngLastRow + 1, 2), True
SendKeys "{F2}"
End With
Fin:
If Err.Number 0 Then MsgBox "Error: " & _
Err.Number & " " & Err.Description
End Sub
Wenn ich ihn ausführe, bekomm ich den Fehler:
"Error:9 Index außerhalb des gültigen Bereichs."
Kann mir jemand erklären,was es damit auf sich hat ?
Vielen Dank !