Suche Zeile/Spalte
06.12.2021 18:18:52
Sigi
ich habe zum Suchen Zeile/ Spalte 2 verschiedene Suchen.
Alle führen zum gleichen Ergebnis.
Meine Frage, wo liegt der Unterschied zwischen
Set R = .Columns(2).Find(what ; bzw. Z = .Columns(2).Find
und
Set R = .Rows(1).Find(what ; bzw. Z = .Rows(1).Find(
Danke!
Gruß
Sigi
Sub SuchenZeile()
Dim R As Range
Dim Z As Long
With ThisWorkbook.Worksheets("Tab1")
Set R = .Columns(2).Find(what:="Angebotpositionen", LookIn:=xlValues, lookat:=xlWhole, SearchOrder:=xlByRows, MatchCase:=True)
MsgBox R.Row
Z = .Columns(2).Find("Angebotpositionen", , , , xlByRows, xlPrevious).Row
MsgBox Z
End With
Set R = Nothing
End Sub
Sub SuchenSpalte()
Dim R As Range
Dim Z As Long
With ThisWorkbook.Worksheets("Tab1")
Set R = .Rows(1).Find(what:="Strasse", LookIn:=xlValues, lookat:=xlWhole, SearchOrder:=xlByColumns, MatchCase:=True)
MsgBox R.Column
Z = .Rows(1).Find("Strasse", , , , xlByColumns, xlPrevious).Column
MsgBox Z
End With
Set R = Nothing
End Sub