bonjour,
j'ai une macro que j'ai mdifiée mais elle ne veux pas fonctionner !!
Sub enregistrer()
'
' enregistrer Macro
' Macro enregistrée le 14/03/2008 par POLAIN
'
'Private Sub cmdEnregistrer_Click()
Dim lig As Long
Dim choixLig As Long
Dim col As Long
Dim choixCol As Long
' Trouver la ligne
choixLig = 0
For lig = 7 To 256
If Range("E7") = 0 Then choixLig = 7: Exit For
If Range("E" & lig) = Range("E1") Then choixLig = lig: Exit For
If Range("E" & lig) = 0 And Range("F3") > 1 Then
lig = Range("E65536").End(xlUp).Row + 1
Cells(lig, 5) = Range("E1")
choixLig = lig: Exit For
End If
Next lig
Cells(choixLig, 5) = Range("E1")
' If choixLig = 0 Then
' MsgBox "L'enregistrement n'est pas possible", vbCritical + vbOKOnly, "Erreur"
' Exit Sub
' End If
' Trouver la colonne
choixCol = 0
For col = 6 To 9
If Cells(choixLig, col) = 0 Then
choixCol = col
Exit For
End If
Next col
If choixCol = 0 Then
MsgBox "L'enregistrement n'est pas possible", vbCritical + vbOKOnly, "Erreur"
Exit Sub
End If
' Afficher le résultat
Cells(choixLig, choixCol).Value = Range("I1").Value
'and
Sheets("récap").Select
Ligne = Range("A65536").End(xlUp).Row + 1
Cells(Ligne, 1) = Sheets("tableau").Range("E1")
Cells(Ligne, 2) = Sheets("tableau").Range("H1")
Cells(Ligne, 3) = Sheets("tableau").Range("G1")
Cells(Ligne, 4) = Sheets("tableau").Range("I1")
'and
Workbooks("tempsmmss").Select
Ligne = Range("A65536").End(xlUp).Row + 1
Cells(Ligne, 1) = Sheets("tableau").Range("E1")
Cells(Ligne, 2) = Sheets("tableau").Range("I1")
Cells(Ligne, 3) = Sheets("tableau").Range("H1")
Cells(Ligne, 4) = Sheets("tableau").Range("G1")
'and
Workbooks("Prog2mmss_ok4.xls").Worksheets("tableau").Select
'And
ActiveWorkbook.save
'
End Sub
j'ai essayé plusieurs corrections sans résultats !!
merci Bpol
j'ai une macro que j'ai mdifiée mais elle ne veux pas fonctionner !!
Sub enregistrer()
'
' enregistrer Macro
' Macro enregistrée le 14/03/2008 par POLAIN
'
'Private Sub cmdEnregistrer_Click()
Dim lig As Long
Dim choixLig As Long
Dim col As Long
Dim choixCol As Long
' Trouver la ligne
choixLig = 0
For lig = 7 To 256
If Range("E7") = 0 Then choixLig = 7: Exit For
If Range("E" & lig) = Range("E1") Then choixLig = lig: Exit For
If Range("E" & lig) = 0 And Range("F3") > 1 Then
lig = Range("E65536").End(xlUp).Row + 1
Cells(lig, 5) = Range("E1")
choixLig = lig: Exit For
End If
Next lig
Cells(choixLig, 5) = Range("E1")
' If choixLig = 0 Then
' MsgBox "L'enregistrement n'est pas possible", vbCritical + vbOKOnly, "Erreur"
' Exit Sub
' End If
' Trouver la colonne
choixCol = 0
For col = 6 To 9
If Cells(choixLig, col) = 0 Then
choixCol = col
Exit For
End If
Next col
If choixCol = 0 Then
MsgBox "L'enregistrement n'est pas possible", vbCritical + vbOKOnly, "Erreur"
Exit Sub
End If
' Afficher le résultat
Cells(choixLig, choixCol).Value = Range("I1").Value
'and
Sheets("récap").Select
Ligne = Range("A65536").End(xlUp).Row + 1
Cells(Ligne, 1) = Sheets("tableau").Range("E1")
Cells(Ligne, 2) = Sheets("tableau").Range("H1")
Cells(Ligne, 3) = Sheets("tableau").Range("G1")
Cells(Ligne, 4) = Sheets("tableau").Range("I1")
'and
Workbooks("tempsmmss").Select
Ligne = Range("A65536").End(xlUp).Row + 1
Cells(Ligne, 1) = Sheets("tableau").Range("E1")
Cells(Ligne, 2) = Sheets("tableau").Range("I1")
Cells(Ligne, 3) = Sheets("tableau").Range("H1")
Cells(Ligne, 4) = Sheets("tableau").Range("G1")
'and
Workbooks("Prog2mmss_ok4.xls").Worksheets("tableau").Select
'And
ActiveWorkbook.save
'
End Sub
j'ai essayé plusieurs corrections sans résultats !!
merci Bpol