capital letters and cell value

  • Thread starter Thread starter caroline
  • Start date Start date
C

caroline

I am trying to see if a name already exists in a list. It
works with the following code (except that it does not
recognise capital letters, for instance it will not
detect that Smith and smith are the same). I tried also
with Cell.text instead of Cell.value, but it gives me the
same problem. Any idea?

Dim Var As Range
Set Var = Range("list")
Dim Cell As Range
For Each Cell In Var
If Cell.Value = Range("newname").Value Then
MsgBox "This name already exists"
Exit Sub
End If
Next Cell
 
Hi
change the line
If Cell.Value = Range("newname").Value Then
ro
If lcase(Cell.Value) = lcase(Range("newname").Value) Then
 
try
If Cell.Value = Range("newname").Value Then
If ucase(Cell.Value) = ucase(Range("newname").Value) Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top