ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Upper Case and Lower Case (https://www.excelbanter.com/excel-programming/321289-upper-case-lower-case.html)

Scott

Upper Case and Lower Case
 
The below function and snipplet will find the string "AD" fine. My problem
is that I have a cell before the cell containing "AD" that contains the word
"Grade". Is there a way to use either LCASE or UCASE to differentiate
between lower case and upper case strings? If so, should I modify the
FINDCELL function to use UCase or LCase?


Set cell = FindCell("*" & sSearchString & "*", Sheets(1).Cells)



Function FindCell(searchFor As String, _
searchRange As Range) As Range

Application.DisplayAlerts = False
With searchRange

Set FindCell = .Find(what:=searchFor, After:=.Cells(.Cells.Count), _
LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)

End With
End Function



Claud Balls

Upper Case and Lower Case
 
Why not set matchcase to True?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Scott

Upper Case and Lower Case
 
Can you give me some syntax or point me to where i can find an explanation
of matchcase?

"Claud Balls" wrote in message
...
Why not set matchcase to True?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




Norman Jones

Upper Case and Lower Case
 
Hi Scott,

Look at "Find Method" in VBA help.

The MatchCase argument can only take the values True or False.

---
Regards,
Norman



"scott" wrote in message
...
Can you give me some syntax or point me to where i can find an explanation
of matchcase?

"Claud Balls" wrote in message
...
Why not set matchcase to True?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!






Claud Balls

Upper Case and Lower Case
 
Look at your own syntax. I have cut out the part where you have set
MatchCase to False:

SearchDirection:=xlNext, MatchCase:=False)



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Scott

Upper Case and Lower Case
 
that's for pointing out the obvious.

"Claud Balls" wrote in message
...
Look at your own syntax. I have cut out the part where you have set
MatchCase to False:

SearchDirection:=xlNext, MatchCase:=False)



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 07:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com