Fusion Bouton+MAcro

MARQUIEJ

XLDnaute Nouveau
Bonjour,

Voilà mon problème, j'ai deux boutons de commande et une macro attachée à une zone texte. L'utilisateur doit successivement appuyer sur les deux boutons et sur la macro, j'aimerais pouvoir tout réunir sur un bouton ou sur une macro.
Malheureusement je débute là dedans et c'est pourquoi j'ai besoin de votre aide.
Voici les codes que j'aimerais réunir:

Bouton 1:
Private Sub CommandButton1_Click()

Dim i As Byte
For i = 1 To 7
Shapes("Picture " & i).Visible = Not Shapes("Picture " & i).Visible
Next i

End Sub

Bouton 2:
Private Sub CommandButton2_Click()
Dim i As Byte
For i = 8 To 10
Shapes("Picture " & i).Visible = Not Shapes("Picture " & i).Visible
Next i

End Sub

Macro:
Sub Ne_pas_déréférencerXLS()
'
' Ne_pas_déréférencerXLS Macro
' Macro enregistrée le 24/08/2010 par FDV0114
'

'
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 4
Range("J15:p19").Select
Selection.Font.ColorIndex = 2
Selection.Interior.ColorIndex = 2
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("A17").Select
End Sub

Merci d'avance pour votre aide,

Julien
 

Pierrot93

XLDnaute Barbatruc
Re : Fusion Bouton+MAcro

Bonjour,

peut être comme ceci :
Code:
Dim i As Byte
For i = 1 To 10
    Shapes("Picture " & i).Visible = Not Shapes("Picture " & i).Visible
Next i
With Range("J15:P19")
    .Font.ColorIndex = 2
    .Interior.ColorIndex = 2
    .Borders.LineStyle = xlNone
End With

bonne journée
@+
 

Statistiques des forums

Discussions
312 508
Messages
2 089 137
Membres
104 045
dernier inscrit
Megajoules