Hello All,
First problem:
I have code. It acts correctly, but
1) when I fill cells for method drag and drop
2) when I delete a few cells
In these cases displays mistake.
How to improve this??
Second problem:
How to make to my code compared 4 signs as well as it checked the
correctness of formula?
For example:
nag= "NGDf"
x= "NGDf-100R"
and wpis = "NGDf"
Comparison is OK, but if user write something different (NGDf-10000R, or
NGDf-1R, or only NGDf) ?? ???
I need the checking the correctness of formulas:
1) LLLL-000L
2) 000.00.0000
where: L - letter; 0 - number
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False ' STOP EVENTS
Dim x, nag, wpis As String
Dim k As Integer
k = 1
x = Target.Value
' blokada wpisu niewłaściwej nazwy cechy do zakładki
While k < 254
If Not Application.Intersect(Columns(k), Target) Is Nothing Then
nag = Right(Cells(1, k), 4)
wpis = Left(x, 4)
'compare 4 signs
If nag <> wpis Then
MsgBox " Pomyliłeś zakładki!!! " & Chr(10) & _
Chr(10) & " Spróbuj ponownie (Try again) "
Target.Value = ""
End If
End If
k = k + 2
Wend
Application.EnableEvents = True 'REACTIVATE EVENTS
Bookmarks