Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Search lastname + firstname (search on uppercase)

Hello,
I have 2 columns a and b containing firstname (a), lastname (b). The data is
input like allways (you never know how) sometimes upper case and lower case
are mixed etc ...
So I would like to be able to search on upper case for both columns. How do
i combine search on both columns and upper case ?

Thanks for help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Search lastname + firstname (search on uppercase)

turn on the macro recorder. Select both columns, Do Edit=find

Uncheck the match case check box.

after completing the find, turn off the macro recorder. Adapt the code.

--
Regards,
Tom Ogilvy


"Fr. Vandecan" wrote:

Hello,
I have 2 columns a and b containing firstname (a), lastname (b). The data is
input like allways (you never know how) sometimes upper case and lower case
are mixed etc ...
So I would like to be able to search on upper case for both columns. How do
i combine search on both columns and upper case ?

Thanks for help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Search lastname + firstname (search on uppercase)

It's not clear how you want "upper case" to apply. The following will
find SMITH & JOHN, but not Smith & John. Using the 2nd If stmt
(commented out) would find Smith & John. Using the 3rd If stmt
(commented out) would find only SMITH & JOHN.

Hth,
Merjet


Sub FindName()
Dim bFound As Boolean
Dim iEnd As Integer
Dim c As Range
Dim rng As Range

iEnd = Sheets("Sheet1").Range("A1").End(xlDown).Row
Set rng = Sheets("Sheet1").Range("A1:A" & iEnd)
For Each c In rng
Debug.Print c
If c = "SMITH" And c.Offset(0, 1) = "JOHN" Then
'If UCase(c) = "SMITH" And UCase(c.Offset(0, 1)) = "JOHN" Then
'If c = UCase("Smith") And c.Offset(0, 1) = UCase("John") Then
MsgBox "Found on row " & c.Row
bFound = True
Exit For
End If
Next c
If bFound = False Then MsgBox ("Name not found.")
End Sub


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
separate lastname from firstname enrico via OfficeKB.com Excel Worksheet Functions 3 April 14th 09 06:56 AM
Is there a way to separate FirstName and LastName ? Mark246 Excel Discussion (Misc queries) 4 February 24th 08 01:42 AM
LastName, FirstName covert to FirstName LastName Craig860 Excel Discussion (Misc queries) 4 January 14th 08 09:58 PM
How to change lastname, firstname to firstname lastname in Excel? mert Excel Discussion (Misc queries) 1 January 9th 08 06:06 PM
LastName, FirstName format Todd Huttenstine[_2_] Excel Programming 2 December 15th 03 02:54 AM


All times are GMT +1. The time now is 10:14 PM.

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

About Us

"It's about Microsoft Excel"