Bei Aufruf dieser Funktion möchte ich bei einer bestimmten Konstellation den Inhalt der Zelle links ausrichten.
mit Application.Caller.HorizontalAlignment = xlLeft (vgl. 3-letzte Codezeile) habe ich das nicht geschafft.
Wer kann mir helfen?
Danke und Gruss, Peter
Public Function LetzterEintrag(lngSpa As Long) As String 'lngSpa = relevante Spalte, ob Wert in _
früherer Tabelle vorhanden
Dim strTabFirst As String, strTabAktuell As String, strTabLast As String, strBezug As String, _
lngZei As Long, Inhalt
strTabFirst = Worksheets(Worksheets("0000").index + 1).Name '1. relevantes Worksheet
strTabLast = Worksheets(Worksheets(Application.Caller.Parent.Name).index - 1).Name 'Worksheet _
Vortag, wenn kein Eintrag vorhanden
strTabAktuell = Application.Caller.Parent.Name 'Abfrage kommt aus Worksheet
If Application.Caller.Offset(0, 12).Value = "" Then
LetzterEintrag = ""
GoTo Ende:
End If
lngZei = Application.Caller.Row
Do
strTabAktuell = Worksheets(Worksheets(strTabAktuell).index - 1).Name
Inhalt = Worksheets(strTabAktuell).Cells(lngZei, lngSpa)
If Inhalt "" Then
LetzterEintrag = strTabAktuell
GoTo Ende:
Else
End If
Loop Until strTabAktuell = strTabFirst
LetzterEintrag = strTabLast
Application.Caller.HorizontalAlignment = xlLeft
Ende:
End Function