INFINITY100
XLDnaute Occasionnel
Bonsoir tout le monde
Voila j'ai la macro ci-dessous créée par un débutant que je trouve un peu longue du coup je cherche à la rendre simple pour quel soit assez facile à comprendre
voici la macro
Merci pour votre aide
Cordialement
Voila j'ai la macro ci-dessous créée par un débutant que je trouve un peu longue du coup je cherche à la rendre simple pour quel soit assez facile à comprendre
voici la macro
Code:
Sub auto_open()
Sheets("Bilan").Select
Application.ScreenUpdating = False
Sheets("Bilan").Unprotect Password:="123456789"
Range("B6").Select
ActiveCell.FormulaR1C1 = "=SUM(BD!R[-4]C[6]:R[1048570]C[6])"
Range("B8").Select
ActiveCell.FormulaR1C1 = "=SUM(encaissement!R[-6]C:R[1048568]C)"
Range("B10").Select
ActiveCell.FormulaR1C1 = "=SUM(Creances!R[-8]C[3]:R[1048566]C[3])"
Range("B12").Select
ActiveCell.FormulaR1C1 = _
"=IF(SUM(R[-6]C[2]:R[-2]C[2])>SUM(R[-6]C:R[-2]C),SUM(R[-6]C[2]:R[-2]C[2])-SUM(R[-6]C:R[-2]C),0)"
Range("D6").Select
ActiveCell.FormulaR1C1 = "=SUM(BD!R[-4]C[2]:R[1048570]C[2])"
Range("D8").Select
ActiveCell.FormulaR1C1 = "=SUM(Charges!R[-6]C:R[1048568]C)"
Range("D10").Select
ActiveCell.FormulaR1C1 = "=SUM(Dettes!R[-8]C[1]:R[1048566]C[1])"
Range("D12").Select
ActiveCell.FormulaR1C1 = _
"=IF(SUM(R[-6]C[-2]:R[-2]C[-2])>SUM(R[-6]C:R[-2]C),SUM(R[-6]C[-2]:R[-2]C[-2])-SUM(R[-6]C:R[-2]C),0)"
Range("B14").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-8]C:R[-2]C)"
Range("D14").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-8]C:R[-2]C)"
Range("A15:D15").Select
Sheets("Feuille démarrage").Select
Sheets("Bilan").Protect Password:="123456789"
Sheets("Divers").Select
Application.ScreenUpdating = False
Sheets("Divers").Unprotect Password:="123456789"
Range("A2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("B2").Select
ActiveCell.FormulaR1C1 = _
"=IF(SUM(BD!R2C6:R1048576C6)>0,SUM(BD!R2C6:R1048576C6),0)"
Range("C2").Select
ActiveCell.FormulaR1C1 = _
"=IF(SUM(BD!R2C8:R1048576C8)>0,SUM(BD!R2C8:R1048576C8),0)"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=IF((R2C3-R2C2)<>0,(R2C3-R2C2),0)"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=IF(R2C2<>0,AVERAGE(BD!R2C10:R1048576C10),0)"
Range("F2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Dettes!R2C5:R1048576C5,"">=0"",Dettes!R2C5:R1048576C5)"
Range("G2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Dettes!R2C5:R1048576C5,""<=0"",Dettes!R2C5:R1048576C5)"
Range("H2").Select
ActiveCell.FormulaR1C1 = "=R2C6+R2C7"
Range("I2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Creances!R2C5:R1048576C5,"">=0"",Dettes!R2C5:R1048576C5)"
Range("J2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Creances!R2C5:R1048576C5,""<=0"",Dettes!R2C5:R1048576C5)"
Range("K2").Select
ActiveCell.FormulaR1C1 = "=R2C9+R2C10"
Range("L2").Select
ActiveCell.FormulaR1C1 = _
"=IF(SUM(Charges!R2C4:R1048576C4)<>0,SUM(Charges!R2C4:R1048576C4),0)"
Range("P2").Select
ActiveCell.FormulaR1C1 = _
"=IF(SUM(encaissement!R2C2:R1048576C2)<>0,SUM(encaissement!R2C2:R1048576C2),0)"
Range("S2").Select
ActiveCell.FormulaR1C1 = "=R2C3-R2C16"
Range("T2").Select
ActiveCell.FormulaR1C1 = "=IF(Bilan!R12C2<>"""",Bilan!R12C2,0)"
Range("U2").Select
ActiveCell.FormulaR1C1 = "=IF(Bilan!R12C4<>"""",Bilan!R12C4,0)"
Range("V2").Select
ActiveCell.FormulaR1C1 = "=R2C3+R2C16+R2C11+R2C20"
Range("W2").Select
ActiveCell.FormulaR1C1 = "=R2C2+R2C12+R2C8+R2C21"
Sheets("Divers").Protect Password:="123456789"
Menu.Show
Application.ScreenUpdating = True
Range("A1").Select
End Sub
Merci pour votre aide
Cordialement