AW: Buttons sperren wenn eine Zeile frei ist
27.06.2023 20:09:14
GerdL
Hallo Bernhard,
teste mal.
Sub Fehlermeldung()
Dim last As Long, strCaption As String, strText As String
With ActiveSheet
last = .Cells(.Rows.Count, 12).End(xlUp).Row
If last = 2 Or (.Cells(last, 12) > Empty And .Cells(last, 13) > Empty And .Cells(last, 14) > Empty) Then
strCaption = .Shapes(Application.Caller).OLEFormat.Object.Caption
strCaption = Replace(strCaption, "N", "Nutzen")
Select Case Split(strCaption)(2)
Case "Loch": strText = strCaption & " oder Riss"
Case "Hängen", "hängen": strText = Replace(strCaption, Split(strCaption)(2), "Teil bleibt hängen")
End Select
.Cells(last + 1, 12).Value = strText
.Cells(last + 1, 13).Value = Date & Format(Time, "hh:mm:ss")
End If
End With
End Sub
Sub Station()
Dim nextrow As Long
With ActiveSheet
nextrow = .Cells(.Rows.Count, 14).End(xlUp).Row + 1
If .Cells(nextrow, 12) > Empty And .Cells(nextrow, 13) > Empty And .Cells(nextrow, 14) = Empty Then
.Cells(last, 14).Value = .Shapes(Application.Caller).OLEFormat.Object.Caption
End If
End With
End Sub
Gruß Gerd