06.11.2018, 07:49
(Dieser Beitrag wurde zuletzt bearbeitet: 06.11.2018, 08:30 von WillWissen.
Bearbeitungsgrund: Codetags
)
Hallo Schauan
wie integriere ich das in diesen Code richtig
und suche mus ich von in A bis AX
Danke vor ab.
wie integriere ich das in diesen Code richtig
Code:
Private Sub CommandButton1_Click()
Dim xSuche, xAdresse, xErste As String
Dim y As Boolean
Dim arr() As Variant
Dim rng As Range
Dim iCounter, iRowU As Integer
ListBox1.Clear
xSuche = TextBox1.Value
If xSuche = "" Then
MsgBox "Bitte erst einen Suchbegriff eingeben!", vbExclamation, "Achtung!"
Exit Sub
End If
If ComboBox1.Value = "" And CheckBox2.Value = False Then
MsgBox "Bitte geben Sie ein, wo der Begriff gesucht werden soll!", vbExclamation, "Achtung!"
Exit Sub
End If
For iCounter = 1 To ThisWorkbook.Sheets.Count
If CheckBox2.Value = True Or Worksheets(iCounter).Name = ComboBox1.Value Then
Set rng = Worksheets(iCounter).Cells.Find _
(xSuche, lookat:=Suchart, LookIn:=xlValues)
If Not rng Is Nothing Then
With Worksheets(iCounter)
xErste = rng.Address(False, False)
y = True
Do Until xAdresse = xErste
ReDim Preserve arr(0 To 50, 0 To iRowU)
arr(0, iRowU) = .Name
arr(1, iRowU) = rng.Address(False, False)
arr(2, iRowU) = .Cells(rng.Row, 4)
arr(3, iRowU) = .Cells(rng.Row, 8)
arr(4, iRowU) = .Cells(rng.Row, 11)
arr(5, iRowU) = .Cells(rng.Row, 18)
arr(6, iRowU) = .Cells(rng.Row, 19)
arr(7, iRowU) = .Cells(rng.Row, 20)
arr(8, iRowU) = .Cells(rng.Row, 44)
arr(9, iRowU) = .Cells(rng.Row, 45)
arr(10, iRowU) = .Cells(rng.Row, 46)
arr(11, iRowU) = .Cells(rng.Row, 47)
arr(12, iRowU) = .Cells(rng.Row, 48)
arr(13, iRowU) = .Cells(rng.Row, 49)
arr(14, iRowU) = .Cells(rng.Row, 50)
iRowU = iRowU + 1
Set rng = .Cells.FindNext(after:=rng)
xAdresse = rng.Address(False, False)
Loop
xAdresse = ""
xErste = ""
End With
End If
End If
Next iCounter
If y = False Then
MsgBox "Der Suchbegriff wurde nicht gefunden!"
Else
ListBox1.Column = arr
End If
End Sub
und suche mus ich von in A bis AX
Danke vor ab.