Problema al abrir el libro de excel con un Modul
He insertado en OpenBook varios módulos de sumas de columnas ayer no tenia problemas hoyal abrir el libro de excel me sale un error que me dice: El methodo de rango del Autofill no se puede ejecutar y no se donde puede estar el error, envío lacodification, por si unos de ustedes me puede ayudar:
Private Sub Workbook_Open()
'Komax
lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AE:AE").Locked = False
Sheets("Data").Range("AE2").Select
ActiveCell.Formula = "=sum(G2:G100)"
Sheets("Data").Range("AE2").AutoFill Destination:=Range("AE2:AE" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AE:AE").Locked = True
'Crimpe
lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AF:AF").Locked = False
Sheets("Data").Range("AF2").Select
ActiveCell.Formula = "=sum(H2:H100)"
Sheets("Data").Range("AF2").AutoFill Destination:=Range("AF2:AF" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AF:AF").Locked = True
'Kolb
lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AG:AG").Locked = False
Sheets("Data").Range("AG2").Select
ActiveCell.Formula = "=sum(I2:I100)"
Sheets("Data").Range("AG2").AutoFill Destination:=Range("AG2:AG" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AG:AG").Locked = True
'Arburg
lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AH:AH").Locked = False
Sheets("Data").Range("AH2").Select
ActiveCell.Formula = "=sum(J2:J100)"
Sheets("Data").Range("AH2").AutoFill Destination:=Range("AH2:AH" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AH:AH").Locked = True
'steinl
lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AI:AI").Locked = False
Sheets("Data").Range("AI2").Select
ActiveCell.Formula = "=sum(K2:K100)"
Sheets("Data").Range("AI2").AutoFill Destination:=Range("AI2:AI" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AI:AI").Locked = True
'Komax Nutzung
lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AJ:AJ").Locked = False
Sheets("Data").Range("AJ2").Select
ActiveCell.Formula = "=sum(O2:O100)"
Sheets("Data").Range("AJ2").AutoFill Destination:=Range("AJ2:AJ" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AJ:AJ").Locked = True
'Crimpe Nutzung
lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AK:AK").Locked = False
Sheets("Data").Range("AK2").Select
ActiveCell.Formula = "=sum(P2:P100)"
Sheets("Data").Range("AK2").AutoFill Destination:=Range("AK2:AK" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AK:AK").Locked = True
'Kolb Nutzung
lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AL:AL").Locked = False
Sheets("Data").Range("AL2").Select
ActiveCell.Formula = "=sum(Q2:Q100)"
Sheets("Data").Range("AL2").AutoFill Destination:=Range("AL2:AL" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AL:AL").Locked = True
'Arburg Nutzung
astrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AM:AM").Locked = False
Sheets("Data").Range("AM2").Select
ActiveCell.Formula = "=sum(R2:R100)"
Sheets("Data").Range("AM2").AutoFill Destination:=Range("AM2:AM" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AM:AM").Locked = True
'Steinlnutzung
lastrow = Sheets("Data").Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Data").Range("AN:AN").Locked = False
Sheets("Data").Range("AN2").Select
ActiveCell.Formula = "=sum(S2:S100)"
Sheets("Data").Range("AN2").AutoFill Destination:=Range("AN2:AN" & lastrow), Type:=xlFillDefault
Sheets("Data").Range("AN:AN").Locked = True
UserForm1.Show
End Sub