Live-Forum - Die aktuellen Beiträge
Datum
Titel
17.04.2024 18:57:33
17.04.2024 16:56:58
Anzeige
Archiv - Navigation
216to220
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
216to220
216to220
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

suche von textstücken in spalten

suche von textstücken in spalten
12.02.2003 17:30:14
mimmo
hallo,

Ich habe ein Problem:

und zwar möchte ich in einer Spalte nach textbruchstücken ((So Ähnlich wie in einem elektronischen Wörterbuch) suchen.
Ich habe es bis jetzt schon geschafft dass er mir die erste Zelle ausgibt in der er das Bruchstück findet, aber mir dann keine weiteren Zellen mehr durchsucht und Ausgibt.

Meine Frage lautet: Ob mir jemand helfen bzw zeigen kann wie man mein Problem am besten Lösen kann

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
Re: suche von textstücken in spalten
12.02.2003 17:41:22
wolf.w.radzinski

1. du hast 2 Probleme a) du zitterst b) suche in der Onlinehilfe nach FINDNEXT

Re: suche von textstücken in spalten
12.02.2003 20:29:50
Josef

Hallo!

Folgenden Text in eine Userform, entsprechende Button anlegen und alles sollte funktionieren.

Schönen abend noch

Josef

Private Sub CommandButtonSuche_Click()
Dim strCheck As String
Dim intI As Integer
Dim intJ As Integer
Dim intCount As Integer
Dim varCheck As Variant
With frmInTextBox
.CommandButtonNext.Enabled = False
.CommandButtonPrevious.Enabled = False
.Repaint
End With
' Type 2 laesst Zahlen und Strings zu.
'strSuche = CStr(Application.InputBox(prompt:="Suche Eintrag...", Type:=2))
varCheck = CStr(Application.InputBox(prompt:="Suche Eintrag...", Type:=2))
'If Len(strSuche) = 0 Then
'If varCheck Then
If Len(varCheck) > 0 And varCheck <> "Falsch" Then

strSuche = CStr(varCheck)
Else
MsgBox "Kein Suchwert eingegeben", vbExclamation
Exit Sub
End If
intJ = frmInTextBox.cboListe1.ListCount
intCount = 0
ReDim strFound(0)
For intI = 0 To intJ - 1
With frmInTextBox
cboListe1.ListIndex = intI
strCheck = cboListe1.Value
If InStr(1, LCase(strCheck), LCase(strSuche)) > 0 Then
ReDim Preserve strFound(intCount)
strFound(intCount) = strCheck
intCount = intCount + 1
End If
End With
Next intI
If intCount = 0 Then
frmInTextBox.cboListe1.ListIndex = 0
MsgBox "Kein passender Eintrag gefunden", vbExclamation
Exit Sub
End If
If UBound(strFound()) >= 0 Then
With frmInTextBox
.CommandButtonNext.Enabled = True
.CommandButtonPrevious.Enabled = False
.cboListe1.Value = strFound(0)
End With
End If
intSelected = 0
End Sub
Private Sub CommandButtonNext_Click()
Dim intNosFound As Integer
intNosFound = UBound(strFound())
strSelected = frmInTextBox.cboListe1.Value
If intSelected < intNosFound Then
Do While strSelected = strFound(intSelected)
intSelected = intSelected + 1
Loop
With frmInTextBox
cboListe1.Value = strFound(intSelected)
End With
End If
frmInTextBox.CommandButtonPrevious.Enabled = True
If intSelected >= intNosFound Then
frmInTextBox.CommandButtonNext.Enabled = False
frmInTextBox.CommandButtonPrevious.SetFocus
End If
End Sub
Private Sub CommandButtonPrevious_Click()
Dim intNosFound As Integer
intNosFound = UBound(strFound())
strSelected = frmInTextBox.cboListe1.Value
If intSelected > 0 Then
Do While strSelected = strFound(intSelected)
intSelected = intSelected - 1
Loop
With frmInTextBox
cboListe1.Value = strFound(intSelected)
End With
End If
frmInTextBox.CommandButtonNext.Enabled = True
If intSelected <= 0 Then
frmInTextBox.CommandButtonPrevious.Enabled = False
frmInTextBox.CommandButtonNext.SetFocus
End If
End Sub

Anzeige
Re: suche von textstücken in spalten
12.02.2003 20:29:50
Josef

Hallo!

Folgenden Text in eine Userform, entsprechende Button anlegen und alles sollte funktionieren.

Schönen abend noch

Josef

Private Sub CommandButtonSuche_Click()
Dim strCheck As String
Dim intI As Integer
Dim intJ As Integer
Dim intCount As Integer
Dim varCheck As Variant
With frmInTextBox
.CommandButtonNext.Enabled = False
.CommandButtonPrevious.Enabled = False
.Repaint
End With
' Type 2 laesst Zahlen und Strings zu.
'strSuche = CStr(Application.InputBox(prompt:="Suche Eintrag...", Type:=2))
varCheck = CStr(Application.InputBox(prompt:="Suche Eintrag...", Type:=2))
'If Len(strSuche) = 0 Then
'If varCheck Then
If Len(varCheck) > 0 And varCheck <> "Falsch" Then

strSuche = CStr(varCheck)
Else
MsgBox "Kein Suchwert eingegeben", vbExclamation
Exit Sub
End If
intJ = frmInTextBox.cboListe1.ListCount
intCount = 0
ReDim strFound(0)
For intI = 0 To intJ - 1
With frmInTextBox
cboListe1.ListIndex = intI
strCheck = cboListe1.Value
If InStr(1, LCase(strCheck), LCase(strSuche)) > 0 Then
ReDim Preserve strFound(intCount)
strFound(intCount) = strCheck
intCount = intCount + 1
End If
End With
Next intI
If intCount = 0 Then
frmInTextBox.cboListe1.ListIndex = 0
MsgBox "Kein passender Eintrag gefunden", vbExclamation
Exit Sub
End If
If UBound(strFound()) >= 0 Then
With frmInTextBox
.CommandButtonNext.Enabled = True
.CommandButtonPrevious.Enabled = False
.cboListe1.Value = strFound(0)
End With
End If
intSelected = 0
End Sub
Private Sub CommandButtonNext_Click()
Dim intNosFound As Integer
intNosFound = UBound(strFound())
strSelected = frmInTextBox.cboListe1.Value
If intSelected < intNosFound Then
Do While strSelected = strFound(intSelected)
intSelected = intSelected + 1
Loop
With frmInTextBox
cboListe1.Value = strFound(intSelected)
End With
End If
frmInTextBox.CommandButtonPrevious.Enabled = True
If intSelected >= intNosFound Then
frmInTextBox.CommandButtonNext.Enabled = False
frmInTextBox.CommandButtonPrevious.SetFocus
End If
End Sub
Private Sub CommandButtonPrevious_Click()
Dim intNosFound As Integer
intNosFound = UBound(strFound())
strSelected = frmInTextBox.cboListe1.Value
If intSelected > 0 Then
Do While strSelected = strFound(intSelected)
intSelected = intSelected - 1
Loop
With frmInTextBox
cboListe1.Value = strFound(intSelected)
End With
End If
frmInTextBox.CommandButtonNext.Enabled = True
If intSelected <= 0 Then
frmInTextBox.CommandButtonPrevious.Enabled = False
frmInTextBox.CommandButtonNext.SetFocus
End If
End Sub

Anzeige

321 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige