Ciao Enzo,
Per gestire la compilazione di più celle, prova un approccio del genere:
'=========>>
Option Explicit
'--------->>
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim SH As Worksheet
Dim arrCelle As Variant, arrAvvisi As Variant
Dim rCell As Range
Dim sMsg As String
Dim i As Long
Const sFoglioDaCompilare As String = "Avviso di sinistro"
'<<=== Modifica
Const sFoglio2DaCompilare As String = "Presa di posizione" '<<=== Modifica
Const sCelleDaCompilare As String = "G14,G20, G22" '<<=== Modifica
Const sCelle2DaCompilare As String = "C5,C7" '<<=== Modifica
Const sAvvisi As String = _
"Inserire data del sinistro nella cella ," _
& "Inserire ora del sinistro nella cella ," _
& "Inserire minuto del sinistro nella cella " '<<=== Modifica
Const sAvvisi2 As String = _
"Inserire cognome collaboratore nella cella ," _
& "Inserire numero GEVA nella cella " '<<=== Modifica
For Each SH In Me.Windows(1).SelectedSheets
With SH
If .Name = sFoglioDaCompilare Then
arrAvvisi = Split(sAvvisi, ",")
arrCelle = Split(sCelleDaCompilare, ",")
For i = LBound(arrCelle) To UBound(arrCelle)
Set rCell = .Range(arrCelle(i))
With rCell
If .Value = vbNullString Then
sMsg = arrAvvisi(i) & .Address(0, 0)
Application.Goto rCell
Cancel = True
GoTo XIT
End If
End With
Next i
ElseIf .Name = sFoglio2DaCompilare Then
arrAvvisi = Split(sAvvisi2, ",")
arrCelle = Split(sCelle2DaCompilare, ",")
For i = LBound(arrCelle) To UBound(arrCelle)
Set rCell = .Range(arrCelle(i))
With rCell
If .Value = vbNullString Then
sMsg = arrAvvisi(i) & .Address(0, 0)
Application.Goto rCell
Cancel = True
GoTo XIT
End If
End With
Next i
End If
End With
Next SH
XIT:
If sMsg <> vbNullString Then
Call MsgBox( _
Prompt:=sMsg, _
Buttons:=vbInformation, _
Title:="REPORT")
End If
End Sub
'<<=========
===
Regards,
Norman
