Error en Visual Basic Excel
Publicado por Alex2cjijon (1 intervención) el 21/07/2021 15:05:58
Tengo un archivo que me permite ir agregando lineas en base a avance de obra y crea en algunas hojas del libero linea para al final tener un resumen general .
Al momento que doy click en la acción click tengo este mensaje..
"El argumento no es opcional"
les envío parte de la sección de la sentencia.
For a = 2 To 5
Sheets("Production-Formato").Range(Cells(5000, 1).End(xlUp).Offset(-7, (10 * (a - 2))), Cells(5000, 1).End(xlUp).Offset(-7, 9 + (10 * (a - 2)))).Copy
Sheets(a).Range("D5000:M5000").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
' We get the operators name from the last row.
OperatorName = Sheets("Production-Formato").Cells(50000, 1).End(xlUp).Offset(0, 3 + (10 * (a - 2)))
' We fetch the Date of the document and copy it in the 2nd row of the Operator sheets.
Sheets("Production-Formato").Cells(3, 100).End(xlToLeft).Copy
Sheets(a).Cells(5000, 2).End(xlUp).PasteSpecial Paste:=xlPasteValues
Sheets(a).Cells(5000, 2).End(xlUp).NumberFormat = "dd/mm/yyyy"
'We Print the operator name in the 3rd row of the Operator sheets.
Sheets(a).Cells(5000, 3).End(xlUp) = OperatorName
'We print the week and day ID
If Right(Sheets(a).Cells(5000, 1).End(xlUp).Offset(-1, 0), 1) <> 7 Then
----->>>>> el compilador marca aqui el fallo Day = Right(Sheets(a).Cells(5000, 1).End(xlUp).Offset(-1, 0), 1) + 1
Sheets(a).Cells(5000, 1).End(xlUp) = Left(Sheets(a).Cells(5000, 1).End(xlUp).Offset(-1, 0), 2) & Day
Else
Week = Left(Sheets(a).Cells(5000, 1).End(xlUp).Offset(-1, 0), 1) + 1
Sheets(a).Cells(5000, 1).End(xlUp) = Week & "_1"
End If
Next a
End Sub
Quedo a la espera de sus comentairios .
Al momento que doy click en la acción click tengo este mensaje..
"El argumento no es opcional"
les envío parte de la sección de la sentencia.
For a = 2 To 5
Sheets("Production-Formato").Range(Cells(5000, 1).End(xlUp).Offset(-7, (10 * (a - 2))), Cells(5000, 1).End(xlUp).Offset(-7, 9 + (10 * (a - 2)))).Copy
Sheets(a).Range("D5000:M5000").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
' We get the operators name from the last row.
OperatorName = Sheets("Production-Formato").Cells(50000, 1).End(xlUp).Offset(0, 3 + (10 * (a - 2)))
' We fetch the Date of the document and copy it in the 2nd row of the Operator sheets.
Sheets("Production-Formato").Cells(3, 100).End(xlToLeft).Copy
Sheets(a).Cells(5000, 2).End(xlUp).PasteSpecial Paste:=xlPasteValues
Sheets(a).Cells(5000, 2).End(xlUp).NumberFormat = "dd/mm/yyyy"
'We Print the operator name in the 3rd row of the Operator sheets.
Sheets(a).Cells(5000, 3).End(xlUp) = OperatorName
'We print the week and day ID
If Right(Sheets(a).Cells(5000, 1).End(xlUp).Offset(-1, 0), 1) <> 7 Then
----->>>>> el compilador marca aqui el fallo Day = Right(Sheets(a).Cells(5000, 1).End(xlUp).Offset(-1, 0), 1) + 1
Sheets(a).Cells(5000, 1).End(xlUp) = Left(Sheets(a).Cells(5000, 1).End(xlUp).Offset(-1, 0), 2) & Day
Else
Week = Left(Sheets(a).Cells(5000, 1).End(xlUp).Offset(-1, 0), 1) + 1
Sheets(a).Cells(5000, 1).End(xlUp) = Week & "_1"
End If
Next a
End Sub
Quedo a la espera de sus comentairios .
Valora esta pregunta


0