Copier la valeur et non la formule
Bonjour à tous,
Je cherche a copier le contenu de cellule d'un fichier vers un autre.
Je suis parti sur la macro suivante :
Mon problème je copie les formules et non la valeur des cellules
Pourriez-vous m'aider SVP ?
Merci
@+
Public Sub CommandButton1_Click() 'copie sauvegarde classeur
Dim nom As String
nom = Day(Date) & Month(Date) & Year(Date) & "-" & Range("H11") & ".xlsm"
ActiveWorkbook.SaveCopyAs "C:\Windsurfing Zone\Factures Clients\Factures" & "\" & nom
rep = MsgBox("Votre base de données est sauvegardée sous le nom : " & nom, vbYes + vbInformation, "Copie sauvegarde classeur")
Range("H11").Value = Range("H11").Value + 1
Dim Synthesefactures As Workbook
Set Synthesefactures = Workbooks.Open("C:\Windsurfing Zone\Factures Clients\Factures\Synthese factures\Synthesefactures.xlsx")
ThisWorkbook.Worksheets("Facture").Range("H10").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("A2")
ThisWorkbook.Worksheets("Facture").Range("H11").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("B2")
ThisWorkbook.Worksheets("Facture").Range("C15").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("C2")
ThisWorkbook.Worksheets("Facture").Range("C16").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("D2")
ThisWorkbook.Worksheets("Facture").Range("C17").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("E2")
ThisWorkbook.Worksheets("Facture").Range("D17").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("F2")
ThisWorkbook.Worksheets("Facture").Range("C18").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("G2")
ThisWorkbook.Worksheets("Facture").Range("C19").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("H2")
ThisWorkbook.Worksheets("Facture").Range("B22").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("I2")
ThisWorkbook.Worksheets("Facture").Range("C22").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("J2")
ThisWorkbook.Worksheets("Facture").Range("D22").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("K2")
ThisWorkbook.Worksheets("Facture").Range("E22").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("L2")
ThisWorkbook.Worksheets("Facture").Range("F38").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("M2")
ThisWorkbook.Worksheets("Facture").Range("G38").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("N2")
ThisWorkbook.Worksheets("Facture").Range("H38").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("O2")
Rhezo a écrit :Bonjour à tous,
Je cherche a copier le contenu de cellule d'un fichier vers un autre.
Je suis parti sur la macro suivante :
Mon problème je copie les formules et non la valeur des cellules
Pourriez-vous m'aider SVP ?
Merci
@+
Public Sub CommandButton1_Click() 'copie sauvegarde classeur
Dim nom As String
nom = Day(Date) & Month(Date) & Year(Date) & "-" & Range("H11") & ".xlsm"
ActiveWorkbook.SaveCopyAs "C:\Windsurfing Zone\Factures Clients\Factures" & "\" & nom
rep = MsgBox("Votre base de données est sauvegardée sous le nom : " & nom, vbYes + vbInformation, "Copie sauvegarde classeur")
Range("H11").Value = Range("H11").Value + 1
Dim Synthesefactures As Workbook
Set Synthesefactures = Workbooks.Open("C:\Windsurfing Zone\Factures Clients\Factures\Synthese factures\Synthesefactures.xlsx")
ThisWorkbook.Worksheets("Facture").Range("H10").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("A2")
ThisWorkbook.Worksheets("Facture").Range("H11").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("B2")
ThisWorkbook.Worksheets("Facture").Range("C15").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("C2")
ThisWorkbook.Worksheets("Facture").Range("C16").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("D2")
ThisWorkbook.Worksheets("Facture").Range("C17").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("E2")
ThisWorkbook.Worksheets("Facture").Range("D17").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("F2")
ThisWorkbook.Worksheets("Facture").Range("C18").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("G2")
ThisWorkbook.Worksheets("Facture").Range("C19").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("H2")
ThisWorkbook.Worksheets("Facture").Range("B22").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("I2")
ThisWorkbook.Worksheets("Facture").Range("C22").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("J2")
ThisWorkbook.Worksheets("Facture").Range("D22").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("K2")
ThisWorkbook.Worksheets("Facture").Range("E22").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("L2")
ThisWorkbook.Worksheets("Facture").Range("F38").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("M2")
ThisWorkbook.Worksheets("Facture").Range("G38").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("N2")
ThisWorkbook.Worksheets("Facture").Range("H38").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("O2")
bonsoir,
remplace tes
ThisWorkbook.Worksheets("Facture").Range("H10").Copy Destination:=Synthesefactures.Worksheets("Synthese").Range("A2")
par
Synthesefactures.Worksheets("Synthese").Range("A2")=ThisWorkbook.Worksheets("Facture").Range("H10")
Génial !!!
Ca marche nickel.
Merci beaucoup.
Petite question subsidiaire ...
A chaque lancement de macro les valeurs copiées sont écrasées alors que je souhaiterai qu'elle s'enregistrent à la ligne suivante.
Sauriez vous me dépanner ?
Merci d'avance
@+
bonsoir,
fait à l'aveugle, à tester
Set Synthesefactures = Workbooks.Open("C:\Windsurfing Zone\Factures Clients\Factures\Synthese factures\Synthesefactures.xlsx")
set ws=Synthesefactures.worksheets("synthese")
dl=ws.range("A" & ws.rows.count).end(xlup).row +1
ws.Range("A" & dl)=ThisWorkbook.Worksheets("Facture").Range("H10")
ws.range("B" & dl)=ThisWorkbook.Worksheets("Facture").Range("H11")
etc ..