ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   search for lowercase letter in two-letter 'word' (https://www.excelbanter.com/excel-programming/439567-search-lowercase-letter-two-letter-word.html)

ppeer

search for lowercase letter in two-letter 'word'
 
Hi There,

If I find a second character lowercase letter in a word, I have to
identify the cell Offset(-1,1).
The words are like: Mc, Mv, Np and are all positioned in column C.
Also there, we find words like MK,LP,ET.

haven't found a solution yet,

Regards

Paul

search for lowercase letter in two-letter 'word'
 
If I understand your request properly :

Find the ones you need like this

If cells(nRow,nCol).value < UCase(cells(nRow,nCol).value) then

' Your code in here

endif

This will find occurences of lower case characters in your cell values.
--
If the post is helpful, please consider donating something to an animal
charity on my behalf .......... and click Yes


"ppeer" wrote:

Hi There,

If I find a second character lowercase letter in a word, I have to
identify the cell Offset(-1,1).
The words are like: Mc, Mv, Np and are all positioned in column C.
Also there, we find words like MK,LP,ET.

haven't found a solution yet,

Regards
.


JLGWhiz[_2_]

search for lowercase letter in two-letter 'word'
 
This will find a lower case string character when you know what the
character will be:

Sub getshorty()
Dim lr As Long, sh As Worksheet, rng As Range
Dim c As Range
Set sh = ActiveSheet
lr = sh.Cells(Rows.Count, 3).End(xlUp).Row
Set rng = sh.Range("C2:C" & lr)
For Each c In rng
If InStr(1, c.Value, "d", vbBinaryCompare) = 2 Then
Set x = c.Offset(-1, 1)
MsgBox x.Address
End If
Next
End Sub


In this case, "d" was the character being searched.

"ppeer" wrote in message
...
Hi There,

If I find a second character lowercase letter in a word, I have to
identify the cell Offset(-1,1).
The words are like: Mc, Mv, Np and are all positioned in column C.
Also there, we find words like MK,LP,ET.

haven't found a solution yet,

Regards




JLGWhiz[_2_]

search for lowercase letter in two-letter 'word'
 
If you only need to find lower case of the second letter and do not know the
character, then this should work.

Sub getshorty()
Dim lr As Long, sh As Worksheet, rng As Range
Dim c As Range
Set sh = ActiveSheet
lr = sh.Cells(Rows.Count, 3).End(xlUp).Row
Set rng = sh.Range("C2:C" & lr)
For Each c In rng
If Not IsEmpty(c) Then
i = Mid(c.Value, 2, 1)
If i = LCase(i) Then
Set x = c.Offset(-1, 1)
MsgBox x.Address
End If
End If
Next
End Sub




"ppeer" wrote in message
...
Hi There,

If I find a second character lowercase letter in a word, I have to
identify the cell Offset(-1,1).
The words are like: Mc, Mv, Np and are all positioned in column C.
Also there, we find words like MK,LP,ET.

haven't found a solution yet,

Regards




Rick Rothstein

search for lowercase letter in two-letter 'word'
 
What you ultimately want to do is not very clear from your posting. For
example... where is this "word" and what action do you envision when you say
"identify"? Perhaps this will help you out... here is a method that tests if
the second character in YourWord (assumed to be a 2-letter word) is lower
case or not...

If YourWord Like "?[a-z]" Then
MsgBox "The second letter of your word is lower case"
Else
MsgBox "The second letter of your word is upper case"
End If

--
Rick (MVP - Excel)


"ppeer" wrote in message
...
Hi There,

If I find a second character lowercase letter in a word, I have to
identify the cell Offset(-1,1).
The words are like: Mc, Mv, Np and are all positioned in column C.
Also there, we find words like MK,LP,ET.

haven't found a solution yet,

Regards




All times are GMT +1. The time now is 02:24 AM.

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