AW: Makro zur auslesung eines Datums
08.07.2019 11:38:42
Torsten
Hallo Robert,
fast alles ist moeglich ;-)
Public Sub Datum_Suchen()
Dim rngFind As Range
Dim strDate As String
Dim a As Long, b As Long, c As Long
strDate = InputBox("Datum:", , CDate(Date))
If strDate = "" Then Exit Sub
a = Sheets("Spreads").Cells(58, Columns.Count).End(xlToLeft).Column
Set rngFind = Sheets("Spreads").Range(Cells(58, 1), Cells(58, a)).Find(strDate, LookIn:= _
xlFormulas)
If Not rngFind Is Nothing Then
b = InputBox("Wieviele Zeilen sollen kopiert werden?", "Zeilen", "1")
Sheets("Spreads").Range(Cells(rngFind.Row, rngFind.Column), Cells(rngFind.Row + b, _
rngFind.Column)).Copy
If Sheets("Spread2").Range("C95") = "" Then
Sheets("Spread2").Range("C95").PasteSpecial xlPasteValues
Application.CutCopyMode = False
Else
c = Sheets("Spread2").Cells(95, Columns.Count).End(xlToLeft).Column
Sheets("Spread2").Cells(95, c + 1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End If
Else
MsgBox "Das Datum wurde nicht gefunden!"
End If
End Sub
Gruss Torsten