Moderatori: Anthony47, Flash30005
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
With Sheets("Foglio2") '<<< Quale foglio Controllare
If Range("A4") > 0 Then
If Range("K4") = "" Then '<<< Quali celle controllare
MsgBox ("Compilare K4 in " & .Name & vbCrLf & "File NON SALVATO")
Cancel = True: Exit Sub
End If
If Range("H7") = "" Then '<<< Quali celle controllare
MsgBox ("Compilare H7 in " & .Name & vbCrLf & "File NON SALVATO")
Cancel = True: Exit Sub
End If
'aggiungere altri CASI usando la stessa sintassi <<<
End If
End With
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
With Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"))
If Range("A4") > 0 Then
If Range("K4") = "" Then
MsgBox ("Compilare campo CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("Q4") = "" Then
MsgBox ("Compilare campo TURNO")
Cancel = True: Exit Sub
End If
If Range("A5") > 0 Then
If Range("H7") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J7") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A10") > 0 Then
If Range("H12") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J12") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A15") > 0 Then
If Range("H17") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J17") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A20") > 0 Then
If Range("H22") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J22") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A25") > 0 Then
If Range("H27") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J27") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A30") > 0 Then
If Range("H32") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J32") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
End If
If Range("A35") > 0 Then
If Range("K35") = "" Then
MsgBox ("Compilare campo CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("Q35") = "" Then
MsgBox ("Compilare campo TURNO")
Cancel = True: Exit Sub
End If
If Range("A36") > 0 Then
If Range("H38") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J38") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A40") > 0 Then
If Range("H42") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J42") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A45") > 0 Then
If Range("H47") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J47") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A50") > 0 Then
If Range("H52") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J52") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A55") > 0 Then
If Range("H57") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J57") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
If Range("A60") > 0 Then
If Range("H62") = "" Then
MsgBox ("Compilare campo POSTAZIONE CONDUTTORE")
Cancel = True: Exit Sub
End If
If Range("J62") = "" Then
MsgBox ("Compilare campo NOME CONDUTTORE")
Cancel = True: Exit Sub
End If
End If
End If
End With
End Sub
=E($A$4>0;K4="")
=E($A$4>0;$A$5>0;H7="")
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Mess As String, cSh
'
Mess = "Compilare Cella!"
Application.ScreenUpdating = False
For Each cSh In Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", _
"17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31")
Sheets(cSh).Select
If Range("A4") > 0 Then
ccell = "K4"
If Range(ccell) = "" Then
Range(ccell).Select
MsgBox Mess
Cancel = True: GoTo Usci
End If
ccell = "Q4"
If Range(ccell) = "" Then
Range(ccell).Select
MsgBox Mess
Cancel = True: GoTo Usci
End If
If Range("A5") > 0 Then
ccell = "H7"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J7"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
'
'tutte le altre condizioni
'tutte le altre condizioni
'tutte le altre condizioni
'
End If
Next cSh
'fine:
Usci:
Application.ScreenUpdating = True
End Sub
Mess = "Compilare Cella!"
Csh=activesheet.name '+++
Application.ScreenUpdating = False
Usci:
Sheets(Csh).Select '+++
Application.ScreenUpdating = True
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Mess As String, cSh
Mess = "Compilare Cella!"
cSh = ActiveSheet.Name
Application.ScreenUpdating = False
For Each cSh In Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", _
"17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31")
Sheets(cSh).Select
If Range("A4") > 0 Then
ccell = "K4"
If Range(ccell) = "" Then
Range(ccell).Select
MsgBox Mess
Cancel = True: GoTo Usci
End If
ccell = "Q4"
If Range(ccell) = "" Then
Range(ccell).Select
MsgBox Mess
Cancel = True: GoTo Usci
End If
If Range("A5") > 0 Then
ccell = "H7"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J7"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A10") > 0 Then
ccell = "H12"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J12"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A15") > 0 Then
ccell = "H17"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J17"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A20") > 0 Then
ccell = "H22"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J22"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A25") > 0 Then
ccell = "H27"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J27"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A30") > 0 Then
ccell = "H32"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J32"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
End If
If Range("A35") > 0 Then
ccell = "K35"
If Range(ccell) = "" Then
Range(ccell).Select
MsgBox Mess
Cancel = True: GoTo Usci
End If
ccell = "Q35"
If Range(ccell) = "" Then
Range(ccell).Select
MsgBox Mess
Cancel = True: GoTo Usci
End If
If Range("A36") > 0 Then
ccell = "H38"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J38"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A41") > 0 Then
ccell = "H43"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J43"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A46") > 0 Then
ccell = "H48"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J48"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A51") > 0 Then
ccell = "H53"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J53"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A56") > 0 Then
ccell = "H58"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J58"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A61") > 0 Then
ccell = "H63"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J63"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A66") > 0 Then
ccell = "H68"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J68"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A71") > 0 Then
ccell = "H73"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J73"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
If Range("A76") > 0 Then
ccell = "H78"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
ccell = "J78"
If Range(ccell) = "" Then
MsgBox Mess
Range(ccell).Select
Cancel = True: GoTo Usci
End If
End If
End If
Next cSh
Usci:
Sheets(cSh).Select
Application.ScreenUpdating = True
End Sub
iSheet = ActiveSheet.Name
Sheets(iSheet).Select
Torna a Applicazioni Office Windows
Mettere tutto MAIUSCOLO un range di celle Autore: raimea |
Forum: Applicazioni Office Windows Risposte: 7 |
Inserire add.in nella barra di avvio veloce in excel 2003 Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 4 |
Trasformare celle con formattazioni in html Autore: servicedynergy |
Forum: Applicazioni Office Windows Risposte: 5 |
Excel: problema con date se devo unirle a testi Autore: valle1975 |
Forum: Applicazioni Office Windows Risposte: 5 |
Visitano il forum: Nessuno e 11 ospiti