Try this then.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Long, myarr, x
If Target.Row < 3 Then Exit Sub
If Target.Column <> 3 And Target.Column <> 4 Then
myarr = Array(" una data ", " il reparto ", " l'operatore ", " il tempo ")
x = Split("1,2,5,6", ",")
For i = 0 To 3
If Cells(Target.Row, CInt(x(i))) = vbNullString Then
Application.EnableEvents = False
MsgBox "Devi inserire" & myarr(i) & "nella cella " & Chr(IIf(i < 2, i, i + 2) + 65) & Target.Row & " ", vbCritical, "Errore!"
Application.Goto Cells(Target.Row, IIf(i < 2, i + 1, i + 3))
Application.EnableEvents = True
Exit For
End If
Next
End If
End Sub
Bookmarks