XL 2016 boite de dialogue pour onglets

bobafric

XLDnaute Occasionnel
Salut à tous
Peut-on créer une boite de dialogue pour ouvrir n'importe quel onglet en tapant le nom de celui-ci
Merci d'avance
 

Pièces jointes

  • boite de dialogue.xlsx
    16.6 KB · Affichages: 15

patricktoulon

XLDnaute Barbatruc
re bonjour
et oui c'est pas simple les combo intuitive dans un sheets leurs events ne réagissent pas tout a fait comme dans un userform et visiblement le refresh est encore plus problématique avec une combo dans une feuille
 
Dernière édition:

patricktoulon

XLDnaute Barbatruc
re
en mettant le matchentry à none dans les propriétés de la combo
tu peux faire ceci
VB:
Option Explicit
Dim tablo()
Private Sub ComboBox1_Change()
    Dim mot$, i&
    If ComboBox1.Value = "" Then ComboBox1.Clear: Exit Sub
    With ComboBox1
        mot = .Value
        .Clear
        On Error Resume Next
        For i = 1 To UBound(tablo)
            If Left(LCase(tablo(i)), Len(.Value)) = .Value Then .AddItem tablo(i)
        Next
        .Value = mot
        If .ListCount = 1 Then
            .Enabled = False: .Enabled = True: .DropDown
            If .ListIndex > -1 Then Sheets(.List(.ListIndex)).Select
        Else
            .ListRows = .ListCount
            .DropDown
        End If
        If .ListCount = 0 Then .Value = Left(.Value, Len(.Value) - 1)
        .Enabled = False: .Enabled = True: .DropDown
    End With
    Application.ScreenUpdating = True
End Sub



Private Sub Worksheet_Activate()
    Dim i As Integer, X&
    Me.ComboBox1.Clear
    ComboBox1.Value = ""
    ReDim tablo(1 To Sheets.Count - 1)
    For i = 1 To Sheets.Count
        If Sheets(i).Name <> "Menu" Then X = X + 1: tablo(X) = Sheets(i).Name
    Next
    'Me.ComboBox1.List = tablo

End Sub
;)
 

bobafric

XLDnaute Occasionnel
re
en mettant le matchentry à none dans les propriétés de la combo
tu peux faire ceci
VB:
Option Explicit
Dim tablo()
Private Sub ComboBox1_Change()
    Dim mot$, i&
    If ComboBox1.Value = "" Then ComboBox1.Clear: Exit Sub
    With ComboBox1
        mot = .Value
        .Clear
        On Error Resume Next
        For i = 1 To UBound(tablo)
            If Left(LCase(tablo(i)), Len(.Value)) = .Value Then .AddItem tablo(i)
        Next
        .Value = mot
        If .ListCount = 1 Then
            .Enabled = False: .Enabled = True: .DropDown
            If .ListIndex > -1 Then Sheets(.List(.ListIndex)).Select
        Else
            .ListRows = .ListCount
            .DropDown
        End If
        If .ListCount = 0 Then .Value = Left(.Value, Len(.Value) - 1)
        .Enabled = False: .Enabled = True: .DropDown
    End With
    Application.ScreenUpdating = True
End Sub



Private Sub Worksheet_Activate()
    Dim i As Integer, X&
    Me.ComboBox1.Clear
    ComboBox1.Value = ""
    ReDim tablo(1 To Sheets.Count - 1)
    For i = 1 To Sheets.Count
        If Sheets(i).Name <> "Menu" Then X = X + 1: tablo(X) = Sheets(i).Name
    Next
    'Me.ComboBox1.List = tablo

End Sub

Désolé Patrick mais je ne suis pas calé en vba et je n'ai pas compris le [B]matchentry [/B]à [B]none [/B]dans les propriétés de la combo je joins un fichier vierge si tu peux le compléter 
[/QUOTE]
Merci
 

Pièces jointes

  • boite de dialogue 2.xlsx
    16.9 KB · Affichages: 7

Discussions similaires

Statistiques des forums

Discussions
312 104
Messages
2 085 334
Membres
102 864
dernier inscrit
abderrashmaen