Una macro en excel no me funciona por que bloquee una celda donde se genera el numero de la factura
Private Sub CommandButton1_Click()
If (MsgBox("¿Esta seguro de Generar Nueva Orden?", vbQuestion + vbYesNo) = vbYes) Then
If Range("H5").Value = "" Or Not IsNumeric(Range("H5").Value) Then
MsgBox "El dato en H5 no es un número"
Exit Sub
End If
Range("B6"). ClearContents
Range("B7"). ClearContents
Range("B8"). ClearContents
Range("B9"). ClearContents
Range("B11"). ClearContents
Range("B14"). ClearContents
Range("C14"). ClearContents
Range("D14"). ClearContents
Range("E14"). ClearContents
Range("F14"). ClearContents
Range("G14"). ClearContents
Range("B18"). ClearContents
Range("C18"). ClearContents
Range("D18"). ClearContents
Range("E18"). ClearContents
Range("F18"). ClearContents
Range("G18"). ClearContents
Range("H18"). ClearContents
Range("I18"). ClearContents
Range("B23"). ClearContents
Range("C23"). ClearContents
Range("D23"). ClearContents
Range("E23"). ClearContents
Range("F23"). ClearContents
Range("G23"). ClearContents
Range("B27"). ClearContents
Range("C27"). ClearContents
Range("D27"). ClearContents
Range("E27"). ClearContents
Range("F27"). ClearContents
Range("G27"). ClearContents
Range("H27"). ClearContents
Range("I27"). ClearContents
Range("H7"). ClearContents
nuevo = Range("H5").Value + 1
Application.DisplayAlerts = False
ActiveWorkbook.ExclusiveAccess
ActiveSheet.Copy After:=Sheets(ActiveWorkbook.Sheets.Count)
ActiveSheet.Name = nuevo
ActiveSheet.Range("H5").Value = nuevo
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.FullName, _
accessMode:=xlShared
Application.DisplayAlerts = True
End If
End Sub