Erreur copier coller
Résolu
juer31
Messages postés
114
Date d'inscription
Statut
Membre
Dernière intervention
-
Frenchie83 Messages postés 2240 Date d'inscription Statut Membre Dernière intervention -
Frenchie83 Messages postés 2240 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
J'ai un code pour copier des valeur de cellules précise vers une autre feuille mais je bloque directemant a la ligne suivante qui est en gras. je n'arrive pas a comprendre ce qui peut clocher.
Quelqu'un peut m'aider?
Option Explicit
Public Const FC = "CALCULS"
Public Const PClient = "C5"
Public Const PContact = "F5"
Public Const DesProjet = "C8"
Public Const NoProjet = "F8"
Public Const TypePrix = "C11"
Public Const Coutant = "E24"
Public Const Vendant = "H24"
Public Const NoteProjet = "I5"
Public Const FH = "HISTORIQUES"
Public Const HPClient = "C"
Public Const HPContact = "E"
Public Const HDesProjet = "G"
Public Const HNoProjet = "I"
Public Const HTypePrix = "J"
Public Const HCoutant = "K"
Public Const HVendant = "L"
Public Const HNoteProjet = "M"
Public Const lideb = 5
Public Sub Histo()
Dim PClient As String, PContact As String, DesProjet As String, NoProjet As String, TypePrix As String, Coutant As String, Vendant As String, NoteProjet As String, liFH As Long
With Sheets(FC)
PClient = .Range(HPClient).Cells(1, 1).Value
PContact = .Range(HPContact).Cells(1, 1).Value
DesProjet = .Range(HDesProjet).Cells(1, 1).Value
NoProjet = .Range(HNoProjet).Cells(1, 1).Value
TypePrix = .Range(HTypePrix).Cells(1, 1).Value
Coutant = .Range(HCoutant).Cells(1, 1).Value
Vendant = .Range(HVendant).Cells(1, 1).Value
NoteProjet = .Range(HNoteProjet).Cells(1, 1).Value
End With
With Sheets(FH)
liFH = .Range(HPClient & Rows.Count).End(xlUp).Row + 1
If liFH <= lideb Then liFH = lideb + 1
.Range(HPClient & liFH).Value = PClient
.Range(HPContact & liFH).Value = PContact
.Range(HDesProjet & liFH).Value = DesProjet
.Range(HNoProjet & liFH).Value = NoProjet
.Range(HTypePrix & liFH).Value = TypePrix
.Range(HCoutant & liFH).Value = Coutant
.Range(HVendant & liFH).Value = Vendant
.Range(HNoteProjet & liFH).Value = NoteProjet
End With
End Sub
J'ai un code pour copier des valeur de cellules précise vers une autre feuille mais je bloque directemant a la ligne suivante qui est en gras. je n'arrive pas a comprendre ce qui peut clocher.
Quelqu'un peut m'aider?
Option Explicit
Public Const FC = "CALCULS"
Public Const PClient = "C5"
Public Const PContact = "F5"
Public Const DesProjet = "C8"
Public Const NoProjet = "F8"
Public Const TypePrix = "C11"
Public Const Coutant = "E24"
Public Const Vendant = "H24"
Public Const NoteProjet = "I5"
Public Const FH = "HISTORIQUES"
Public Const HPClient = "C"
Public Const HPContact = "E"
Public Const HDesProjet = "G"
Public Const HNoProjet = "I"
Public Const HTypePrix = "J"
Public Const HCoutant = "K"
Public Const HVendant = "L"
Public Const HNoteProjet = "M"
Public Const lideb = 5
Public Sub Histo()
Dim PClient As String, PContact As String, DesProjet As String, NoProjet As String, TypePrix As String, Coutant As String, Vendant As String, NoteProjet As String, liFH As Long
With Sheets(FC)
PClient = .Range(HPClient).Cells(1, 1).Value
PContact = .Range(HPContact).Cells(1, 1).Value
DesProjet = .Range(HDesProjet).Cells(1, 1).Value
NoProjet = .Range(HNoProjet).Cells(1, 1).Value
TypePrix = .Range(HTypePrix).Cells(1, 1).Value
Coutant = .Range(HCoutant).Cells(1, 1).Value
Vendant = .Range(HVendant).Cells(1, 1).Value
NoteProjet = .Range(HNoteProjet).Cells(1, 1).Value
End With
With Sheets(FH)
liFH = .Range(HPClient & Rows.Count).End(xlUp).Row + 1
If liFH <= lideb Then liFH = lideb + 1
.Range(HPClient & liFH).Value = PClient
.Range(HPContact & liFH).Value = PContact
.Range(HDesProjet & liFH).Value = DesProjet
.Range(HNoProjet & liFH).Value = NoProjet
.Range(HTypePrix & liFH).Value = TypePrix
.Range(HCoutant & liFH).Value = Coutant
.Range(HVendant & liFH).Value = Vendant
.Range(HNoteProjet & liFH).Value = NoteProjet
End With
End Sub
A voir également:
- Erreur copier coller
- Historique copier coller - Guide
- Copier coller pdf - Guide
- Copier-coller - Accueil - Informatique
- Style d'écriture a copier coller - Guide
- Symbole clavier copier coller - Guide
2 réponses
Bonjour,
Lancez votre macro, sur la ligne en défaut, faite un débogage, quelle est la valeur de "HPClient"?
Etes-vous sûr qu'il s'agit d'une plage?
Range(HPClient) vous semble t-il correct?
Cdlt
Lancez votre macro, sur la ligne en défaut, faite un débogage, quelle est la valeur de "HPClient"?
Etes-vous sûr qu'il s'agit d'une plage?
Range(HPClient) vous semble t-il correct?
Cdlt
Bonjour,
Code allégé
Cdlt
Code allégé
Public Sub Histo() Dim f1, f2 Dim liFH As Long Set f1 = Sheets("CALCULS") Set f2 = Sheets("HISTORIQUES") liFH = f2.[C10000].End(xlUp).Row + 1 f2.Range("C" & liFH).Value = f1.[C5] f2.Range("E" & liFH).Value = f1.[F5] f2.Range("G" & liFH).Value = f1.[C8] f2.Range("I" & liFH).Value = f1.[F8] f2.Range("J" & liFH).Value = f1.[C11] f2.Range("K" & liFH).Value = f1.[E24] f2.Range("L" & liFH).Value = f1.[H24] f2.Range("M" & liFH).Value = f1.[I5] ' etc ... Set f1 = Nothing Set f2 = Nothing End Sub
Cdlt
https://www.cjoint.com/c/IDsmhvtXHaW