Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default capital letters and cell value

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default capital letters and cell value

Hi
change the line
If Cell.Value = Range("newname").Value Then
ro
If lcase(Cell.Value) = lcase(Range("newname").Value) Then

--
Regards
Frank Kabel
Frankfurt, Germany


caroline wrote:
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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default capital letters and cell value

Great. both suggestions lcase and ucase work
Thanks
-----Original Message-----
try
If Cell.Value = Range("newname").Value Then
If ucase(Cell.Value) = ucase(Range("newname").Value)

Then

--
Don Guillett
SalesAid Software

"caroline" wrote

in message
...
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can an excel cell/column be forced to CAPITAL letters only? DuncanM9 Excel Discussion (Misc queries) 1 November 19th 08 11:38 AM
how to change small letters to capital letters HOW TO CHANGE Excel Discussion (Misc queries) 4 May 30th 07 01:12 AM
how do i turn all letters into capital letters? KeithT Excel Discussion (Misc queries) 3 May 11th 07 02:13 PM
Capital Letters Only Simon Jefford Excel Discussion (Misc queries) 2 February 2nd 06 06:04 PM
Capital Letters Gaute Excel Worksheet Functions 4 March 9th 05 09:55 AM


All times are GMT +1. The time now is 03:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"