Suche und Spaltensprünge
30.06.2019 14:57:59
Andreas
benötige wieder mal eure professionelle Hilfe.
Ich möchte bestimmte Werte in einem Arbeitsblatt suchen (eigentlich soll es das ganze Workbook sein - aber das bekomme ich mit der schleife nicht hin :-( )
Ein Userform bekommt die entsprechenden Werte aus der Tabelle. Danach soll es auf den ausgangswert txt_Name wieder selektiert werden. Nun ist die Herausforderung , das diese Spaltensprünge variabel sind.
Hier mal das Skript:
Private Sub cmd_weiter_Click()
Dim i As Integer
Cells.Find(What:=Me.txt_Name, After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Cells.FindNext(After:=ActiveCell).Activate
Me.txt_Name = ActiveCell.Value
ActiveCell.Offset(0, 1).Range("A1").Select
Me.cbo_Abteilung = ActiveCell.Value
ActiveCell.Offset(0, 1).Range("A1").Select
Me.cbo_Wunsch = ActiveCell.Value
ActiveCell.Offset(0, -2).Range("A1").Select
i = ActiveSheet.Cells(1, Columns.Count).End(xlToRight).Columns
Cells(Selection.Row, 1).Select
Me.txt_Datum = ActiveCell.Value
Cells(Selection.Row, i).Select
End Sub
Ich hoffe Ihr könnt mir helfen.