O
Otto Moehrbach
Excel XP & Win XP
I have a range of cells, all formatted as text. The user will enter numbers
into those cells, one at a time. I want to trap the instance where the user
will enter the same number twice into this range of cells. I am using the
VBA line:
If Application.CountIf(TheRng, Target.Value) > 1 Then....
to trap the repeating number.
The problem is that the user may enter "8" in one cell and "08" in another.
In this instance, the above line of code will count this as 2 entries of the
same number. Because these cells are formatted as text, "8" and "08" are
not the same and should not be counted as a repeating entry.
How can I write the code so that VBA does not consider "8" and "08" as the
same? Thanks for your time. Otto
I have a range of cells, all formatted as text. The user will enter numbers
into those cells, one at a time. I want to trap the instance where the user
will enter the same number twice into this range of cells. I am using the
VBA line:
If Application.CountIf(TheRng, Target.Value) > 1 Then....
to trap the repeating number.
The problem is that the user may enter "8" in one cell and "08" in another.
In this instance, the above line of code will count this as 2 entries of the
same number. Because these cells are formatted as text, "8" and "08" are
not the same and should not be counted as a repeating entry.
How can I write the code so that VBA does not consider "8" and "08" as the
same? Thanks for your time. Otto