lier cellules de 2 onglet avec incrementation

  • Initiateur de la discussion Initiateur de la discussion jja2
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

jja2

XLDnaute Nouveau
Bonjour à tous
merci pour l'aide que vous avez déjà apporté, mais me revoilà planter !

j'ai creer un userform ou je rentre les elements d'un ensemble dans une feuill qui porte le nom de l'ensemble, ensuite j'ai le total des differente tailles en ligne 27 ( A: L ).

je voudrais lier ses données à une feuille"stock" , mais comme j'ai plusieurs feuilles qui doivent s'afficher sur "stock" j'ai besoin que çà s'affiche les un sous les autres.

Et c'est là que je bloque, avec mon code çà plante le debuggeur me donne:
ActiveSheet.Paste Link:=True


pourtant j'ai fait la macro avec l'enregistreur et j'ai ajouté Derlign = .Range("A65000").End(xlUp).Row + 1


code du bouton qui lance çà :


Private Sub CommandButton1_Click()
Range("A2").Select
Selection.Copy
Range("A27").Select
ActiveSheet.Paste
Range("B27").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=MIN(R[-17]C:R[-3]C)"
Selection.Copy
Range("C27:L27").Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

With Sheets("stock")
Derlign = .Range("A65000").End(xlUp).Row + 1

Range("A27:L27").Select
Selection.Copy
Sheets("stock").Select


ActiveSheet.Paste Link:=True

End With


' verouiller page stock
Sheets("stock").Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True





'deverouillage de la page mot de passe antoine
Sheets("historiq").EnableSelection = xlUnlockedCells
ActiveSheet.Unprotect



'mise à jour historique
i = Sheets("historiq").Range("a65536").End(xlUp).Row + 1
Sheets("historiq").Range("a" & i) = Format(Date, "dddd d mmm yyyy")
Sheets("historiq").Range("b" & i) = Format(Time, "h:mm:ss")

Sheets("historiq").Range("c" & i) = Range("A2")
Sheets("historiq").Range("d" & i) = (" création de l'ensemble")


' verouiller page historiq
Sheets("historiq").Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True

'verouille page ensemble
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True

Unload Me


Sheets("Feuil1").Select
'retourne à la feuille 1
MsgBox (" Le nouvel ensemble est enregistré ")
ActiveWorkbook.Save
End Sub
 
Re : lier cellules de 2 onglet avec incrementation

Bonjour,

A tout hasard, essayez avec le code modifié

Code:
Private Sub CommandButton1_Click()
Range("A2").Select
Selection.Copy
Range("A27").Select
ActiveSheet.Paste
Range("B27").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=MIN(R[-17]C:R[-3]C)"
Selection.Copy
Range("C27:L27").Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

With Sheets("stock")
Derlign = .Range("A65000").End(xlUp).Row + 1

Range("A27:L27").Select
Selection.Copy
Sheets("stock").Select

[COLOR="Blue"]Range("A" & Derlign & "").Select   'ajout pmo[/COLOR]

ActiveSheet.Paste Link:=True

End With


' verouiller page stock
Sheets("stock").Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True





'deverouillage de la page mot de passe antoine
Sheets("historiq").EnableSelection = xlUnlockedCells
ActiveSheet.Unprotect



'mise à jour historique
i = Sheets("historiq").Range("a65536").End(xlUp).Row + 1
Sheets("historiq").Range("a" & i) = Format(Date, "dddd d mmm yyyy")
Sheets("historiq").Range("b" & i) = Format(Time, "h:mm:ss")

Sheets("historiq").Range("c" & i) = Range("A2")
Sheets("historiq").Range("d" & i) = (" création de l'ensemble")


' verouiller page historiq
Sheets("historiq").Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True

'verouille page ensemble
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True

Unload Me


Sheets("Feuil1").Select
'retourne à la feuille 1
MsgBox (" Le nouvel ensemble est enregistré ")
ActiveWorkbook.Save
End Sub

Cordialement.

PMO
Patrick Morange
 
Re : lier cellules de 2 onglet avec incrementation

Bonjour à tous et merci pour l'aide que vous m'avez apporté .

voici le lien du fichier " fini".
si quelqu'un à des idées pour améliorer je suis biensûr preneur !

merci encore


lien du fichier zip :

Ce lien n'existe plus celine.zip
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
17
Affichages
1 K
Réponses
2
Affichages
1 K
Retour