Aide sur un combobox fonctionnalité
Résolu
Cedric_hess
Messages postés
28
Date d'inscription
Statut
Membre
Dernière intervention
-
Cedric_hess Messages postés 28 Date d'inscription Statut Membre Dernière intervention -
Cedric_hess Messages postés 28 Date d'inscription Statut Membre Dernière intervention -
Bonjour tout le monde ,
j'ai besoin de votre aide SVP ,sur mon userform j'ai deux combobox chaqu'un me permet de choisir une feuille dans mon fichier excel enfaite ce que je veux c'est quand je choisis les deux feuilles des deux combobox qu'on puisse copier toutes les colonnes des deux feuilles dans une autre feuille dans le meme fichier excel est ce que c'est possible de faire ca merci
Voila le code VBA que j'utilise pour choisire du combobox :
et voila le fichier excel sur lequelle je travaille :cjoint.com/c/FDvl1kkSHcv
j'ai besoin de votre aide SVP ,sur mon userform j'ai deux combobox chaqu'un me permet de choisir une feuille dans mon fichier excel enfaite ce que je veux c'est quand je choisis les deux feuilles des deux combobox qu'on puisse copier toutes les colonnes des deux feuilles dans une autre feuille dans le meme fichier excel est ce que c'est possible de faire ca merci
Voila le code VBA que j'utilise pour choisire du combobox :
Private Sub ComboBox1_Change()
Const ColItems As Long = 20
Const LetterWidth As Long = 20
Const HeightRowz As Long = 18
Const SheetID As String = "__SheetSelection"
Dim i%, TopPos%, iSet%, optCols%, intLetters%, optMaxChars%, optLeft%
Dim wsDlg As DialogSheet, objOpt As OptionButton, optCaption$, objSheet As Object
optCaption = "": i = 0
Application.ScreenUpdating = False
On Error Resume Next
Application.DisplayAlerts = False
ActiveWorkbook.DialogSheets(SheetID).Delete
Application.DisplayAlerts = True
Err.Clear
Set wsDlg = ActiveWorkbook.DialogSheets.Add
With wsDlg
.Name = SheetID
.Visible = xlSheetHidden
iSet = 0: optCols = 0: optMaxChars = 0: optLeft = 78: TopPos = 40
For Each objSheet In ActiveWorkbook.Sheets
If objSheet.Visible = xlSheetVisible Then
i = i + 1
If i Mod ColItems = 1 Then
optCols = optCols + 1
TopPos = 40
optLeft = optLeft + (optMaxChars * LetterWidth)
optMaxChars = 0
End If
intLetters = Len(objSheet.Name)
If intLetters > optMaxChars Then optMaxChars = intLetters
iSet = iSet + 1
.OptionButtons.Add optLeft, TopPos, intLetters * LetterWidth, 16.5
.OptionButtons(iSet).Text = objSheet.Name
TopPos = TopPos + 13
End If
Next objSheet
If i > 0 Then
.Buttons.Left = optLeft + (optMaxChars * LetterWidth) + 24
With .DialogFrame
.Height = Application.Max(68, WorksheetFunction.Min(iSet, ColItems) * HeightRowz + 10)
.Width = optLeft + (optMaxChars * LetterWidth) + 24
.Caption = "Select sheet to go to"
End With
.Buttons("Button 2").BringToFront
.Buttons("Button 3").BringToFront
Application.ScreenUpdating = True
If .Show = True Then
For Each objOpt In wsDlg.OptionButtons
If objOpt.Value = xlOn Then
optCaption = objOpt.Caption
Exit For
End If
Next objOpt
End If
If optCaption = "" Then
MsgBox "You did not select a worksheet.", 48, "Cannot continue"
Exit Sub
Else
MsgBox "You selected the sheet named ''" & optCaption & "''." & vbCrLf & "Click OK to go there.", 64, "FYI:"
Sheets(optCaption).Activate
End If
End If
Application.DisplayAlerts = False
.Delete
Application.DisplayAlerts = True
End With
End Sub
et voila le fichier excel sur lequelle je travaille :cjoint.com/c/FDvl1kkSHcv
A voir également:
- Aide sur un combobox fonctionnalité
- Cette fonctionnalité nécessite un média amovible - Forum Windows 8 / 8.1
- Mise à jour de fonctionnalité vers windows 10 version 22h2 - Accueil - Mise à jour
- Un hyperviseur a été détecté. les fonctionnalités nécessaires à hyper-v ne seront pas affichées. - Windows 11
- Vous ne pouvez pas utiliser cette fonctionnalité pour le moment ✓ - Forum Facebook
- Une application de votre pc necessite la fonctionnalité windows suivante ✓ - Forum Windows 10
1 réponse
rebonjour tt le monde
voila la solution pour ceux qui sont interessées il faut just remplacer cette partie de code
voila la solution pour ceux qui sont interessées il faut just remplacer cette partie de code
Sheets(optCaption).Activatepar
Sheets(optCaption).Range("A1:F10000").copy Destination:=Sheets("operations").Range("A1:F10000")et ca copie les colonnes de la feuille qu'on select dans le combobox dans la feuille operation