![]() |
|
Forum
|
|
|
#1 (permalink) |
|
XLDnaute Occasionel
Date d'inscription: juillet 2006
Localisation: nancy
Version Excel : Excel XP (PC)
Messages: 486
|
bonjour à tous
Grace à vous j ai obtenu cette macro qui fonctionne tres bien si CommandButton3 se trouve sur la feuille concernée mais si je place le contenu de cette meme macro [Private Sub CommandButton3_Click()] dans un USF sur un OptionButton3 ça ne marche plus et je ne comprend pas pourquoi !! pouvez vous m aider a comprendre mon erreur? je vous en remercie d avance bonne soirée à tous E et F Public Flag As Boolean __________________________________________________ _________ Private Sub CommandButton3_Click() Range("D3:E600").Activate Flag = 1 Selection.ClearContents Range("A3").Select End Sub __________________________________________________ ____________ Private Sub Worksheet_Change(ByVal Target As Range) If Flag = 0 Then If Not Application.Intersect(Target, Range("E3:E65536")) Is Nothing Then RETOUR = MsgBox("Voulez-vous valider cette commande ", 4 + vbInformation, " V A L I D A T I O N ") If RETOUR = vbYes Then Application.ScreenUpdating = False Range("A" & ActiveCell.Row & ":F" & ActiveCell.Row).Copy Sheets("COMMANDES").Range("A65536").End(xlUp).Offs et(1, 0).PasteSpecial Paste:=xlPasteValues Application.CutCopyMode = False UserForm1.Show Application.ScreenUpdating = True End If End If End If Flag = 0 End Sub |
|
|
|
| ANNONCES | |||
|
|
|
|
#2 (permalink) |
|
XLDnaute Barbatruc
Date d'inscription: janvier 2006
Localisation: 69400 LIMAS
Version Excel : Excel 2000 (PC)
Messages: 6 023
|
bonjour Evelynetfrancois
un petit fichier exemple nous simplifierait le debuggage est-ce possible ? |
|
|
|
|
|
#3 (permalink) |
|
XLDnaute Occasionel
Date d'inscription: juillet 2006
Localisation: nancy
Version Excel : Excel XP (PC)
Messages: 486
|
bonsoir PierreJean
oups ! je viens de faire une version tres light !! il m a fallu quelques minutes !!! j espere erte clair dans mon fichier ........ a bientot E et F |
|
|
|
|
|
#4 (permalink) |
|
XLDnaute Accro
Date d'inscription: juillet 2006
Localisation: Nantes
Version Excel : Excel 2003 (PC)
Messages: 1 037
|
Bonsoir Evelynetfrancois, pierrejean
Je pense que ton problème vient de la déclaration de la variable Flag. Pour qu'elle soit applicable à toutes les procédures du classeur il faut la déclarer dans un module de code standard. (avant la première ligne de code) Dans ton module 1, tout au début met ceci : Code:
Option Explicit Public Flag As Boolean Bonne fin de soirée
__________________
Dernière modification par bqtr ; 18/04/2007 à 23h11. |
|
|
|
|
|
#5 (permalink) |
|
XLDnaute Occasionel
Date d'inscription: juillet 2006
Localisation: nancy
Version Excel : Excel XP (PC)
Messages: 486
|
BONSOIR bqtr
c est tout a fait cela !! je te remercie beaucoup pour ce super coup de pouce je n'aurais pas trouver seul . MERCI pour tout bonne soirée E et F |
|
|
|
| ANNONCES | |
![]() |
| Liens sociaux |
| Outils de la discussion | |
|
|
Discussions similaires
|
||||
| Discussion | Auteur | Forum | Réponses | Dernier message |
| Bug sur macro Sub Worksheet_Change(ByVal Target As Range) | marmotte18 | Forum Excel | 13 | 10/04/2007 19h19 |
| Private Sub Worksheet_Change(ByVal Target As Range) | Evelynetfrancois | Forum Excel | 2 | 08/04/2007 16h50 |
| Worksheet_SelectionChange(ByVal Target As Range) | PAD | Forum Excel | 2 | 18/04/2006 19h14 |
| Worksheet_Change(ByVal | fifi | Forum Excel | 8 | 04/10/2005 22h18 |
| Private Sub Worksheet_Change(ByVal Target As Range) | Xtian (du Québec) | Forum Excel Downloads - Archives | 3 | 25/01/2005 23h12 |