Select cell with upper case letters

F

Fred Smith

I need to clean up a file of imported data.

The rows that I want are where the text in the cell in Column A is in
uppercase. If there some formula in VBA which I can use to determine whether
I have all uppercase letters in a cell?
 
B

Bob Phillips

FVred,

Not a formula that I know of, but here is some VBA

Dim cLastRow As Long
Dim i As Long
Dim rng As Range

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To cLastRow
If Cells(i,"A").Value = UCase(Cells(i,"A").Value) Then
If rng Is Nothing Then
Set rng = Cells(i,"A")
Else
Set rng = Union(rng,Cells(i,"A"))
End If
End If
Next i
If Not rng Is Nothing Then
rng.Select
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
J

Jim Becker

Short answer:
tmpCell.Value = UCase(tmpCell.Value)

Longer answer:
Dim tmpRange As Range
Dim tmpCell As Range
Dim tmpColumn As Range

Set tmpRange = Workbooks("Book1").Worksheets("Sheet1").UsedRange

With tmpRange
For Each tmpCell In tmpRange.Rows(1).Cells
If tmpCell.Value = UCase(tmpCell.Value) Then
Set tmpColumn = tmpRange.Columns(tmpCell.Column)

MsgBox tmpColumn.Address
' perform actions on tmpColumn here...

End If
Next tmpCell
End With

Hope this helps...
~
~
~
:wq!
 
A

Ajtb

Hi Fred
This should work:

If cells(10,1) = Ucase(cells(10,1)) then

do what you need to do

end if

Regards

Andrew Bourke
 
E

EvolBob

You could flag and sort them with a formula.

=EXACT(F2,UPPER(F2))


Regards
Robert McCurdy
 

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

Top