Potresti scrivere una macro da eseguire nel momento in cui vengono modificate le celle nel range indicato.
Questo è un esempio:
codice:
Private Sub Worksheet_Change(ByVal Target As Range)
Const RigaInizio As Integer = 1
Const RigaFine As Integer = 400
Const CifreDecimali As Integer = 2
Dim ContRiga As Integer
Dim Cella As String
Dim Decimali As String
If Not Intersect(Target, Me.Range("B1:B400")) Is Nothing Then
For ContRiga = RigaInizio To RigaFine
Cella = Cells(ContRiga, 2).Text
If IsNumeric(Cella) = False Then
Me.Cells(ContRiga, 2).Select
MsgBox "Valore non numerico", vbInformation, "Cella B" & CStr(ContRiga)
Else
If InStr(1, Cella, ",") > 1 Then
Decimali = Mid(Cella, InStr(1, Cella, ",") + 1)
If Len(Decimali) > CifreDecimali Then
Me.Cells(ContRiga, 2).Select
MsgBox "Numero cifre decimali superiori al limite (" & CStr(CifreDecimali) & ")", vbInformation, "Cella B" & CStr(ContRiga)
End If
End If
End If
Next ContRiga
End If
End Sub