Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1036to1040
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
Inhaltsverzeichnis

Problem Symbolleiste + Eingabebox

Problem Symbolleiste + Eingabebox
13.01.2009 08:00:00
SteffenS
Hallo Zusammen,
ich erzeuge in einer Symbolleiste zwei Symbole.
Eine Eingabebox und ein Suchsymbol.
Gebe ich in die Eingabebox etwas ein, drücke ENTER funktioniert alles einwandfrei
Gebe ich danach eine anderen Begriff ein und Drücke auf den Suchen Button, so wird der Erste Begriff wieder in die Eingabebox eingegeben.
Wie bekomme ich es hin, dass nach dem "neuen" Begriff gesucht wird?
Hier mein Code
'Händlersuche
Dim cmfedit As CommandBarControl
Set cmfedit = Application.CommandBars("Planungsauswertung").Controls.Add(Type:=msoControlEdit)
cmfedit.TooltipText = "Händlernummer oder Name eingeben und mit ENTER bestätigen"
cmfedit.Width = 100
cmfedit.OnAction = "symb_hdl_suche"
cmfedit.BeginGroup = True
cmfedit.Tag = "hdlsuche"
Set cmfButton = Application.CommandBars("Planungsauswertung").Controls.Add
cmfButton.FaceId = 202
cmfButton.Style = msoButtonIconAndCaption
cmfButton.TooltipText = "Händlernummer oder Name suchen"
cmfButton.OnAction = "symb_hdl_suche"
Set cmfedit = Nothing
'Makros das ausgeführt wird
</p><pre>Sub symb_hdl_suche()
'Spaltenauswahl über Symbolleiste
'Abfrage ob Detailfenster offen ist
If show_det_tb.Visible = True Then Unload show_det_tb
Dim ADMALLG As Worksheet
Set ADMALLG = Workbooks(ThisWorkbook.Name).Sheets("adm_einst")
Dim basw As String
Dim last_cell As Long, i As Long, sspalte As Long
Dim enr As Long
Dim objList As CommandBarControl
Set objList = CommandBars.ActionControl.Parent.FindControl(Tag:="hdlsuche")
basw = objList.Text
'basw = CommandBars.ActionControl.Text
If basw <> "" Then
'letze Zelle ermitteln
last_cell = Cells(Rows.Count, 1).End(xlUp).Row
'Spalte ermitteln
For i = 7 To last_cell
If Rows(i).EntireRow.Hidden = False Then
If Cells(i, 1).Value Like "*" & basw & "*" Then
sspalte = 1
GoTo raus
ElseIf Cells(i, 3).Value Like "*" & basw & "*" Then
sspalte = 3
GoTo raus
End If
End If
Next
raus:
If sspalte = 0 Then
Else
'Zelle auswählen
Cells(i, sspalte).Select
End If
End If
End Sub</pre><p>
Danke Euch im Voraus
MFG
Steffen Schmerler

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Problem Symbolleiste + Eingabebox
13.01.2009 10:07:55
mumpel
Hallo!
Es ist unklug, eine separate Sub zu verwenden. Man kann ein Editcontrol auch direkt ansprechen. Eine separate Suchschaltläche ist nicht notwendig. Du solltest Deine Setcolor>-Anweisungen am Ende immer zurücksetzen. So sollte es funktionieren.
Option Explicit

Sub symb_hdl_suche()
On Error Resume Next
Dim Zelle As Integer
Dim objList As CommandBarControl
Dim ADMALLG As Worksheet
Dim basw As String
Dim last_cell As Long, i As Long, sspalte As Long
Dim enr As Long
Set objList = CommandBars.ActionControl
basw = objList.Text
If show_det_tb.Visible = True Then Unload show_det_tb
Set ADMALLG = Workbooks(ThisWorkbook.Name).Sheets("adm_einst")
If basw <> "" Then
last_cell = Cells(Rows.Count, 1).End(xlUp).Row
For i = 7 To last_cell
If Rows(i).EntireRow.Hidden = False Then
If Cells(i, 1).Value Like "*" & basw & "*" Then
sspalte = 1
GoTo raus
ElseIf Cells(i, 3).Value Like "*" & basw & "*" Then
sspalte = 3
GoTo raus
End If
End If
Next
raus:
If sspalte = 0 Then
Else
Cells(i, sspalte).Select
End If
End If
Set objList = Nothing
Set ADMALLG = Nothing
End Sub

Code eingefügt mit VBA in HTML 2.0size>
Gruß, René

Anzeige
Danke das wars
13.01.2009 20:05:00
SteffenS
MFG
Steffen

299 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige