Identify All Cells Not Capital Macro

XLML

Active Member
Joined
Aug 15, 2003
Messages
407
Hi,

I am looking for a macro that will check all cells in any column I choose (Column C for instance).

During the check, it should identify all cells in which alpha characters are not capital. (perhaps by changing the background color of the cell to red)

The only issue I see is that a cell might contain both alpha and numberic characters.

For instance, "998Test" should be flagged b/c the "e", "s" and "t" in the cell are lowercase.

Thanks in advance,
XLML
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

tactps

Well-known Member
Joined
Jan 20, 2004
Messages
3,460
This should do it:

Sub macro()
Dim cell As Range
ActiveCell.EntireColumn.Select 'You may want to limit your selection
For Each cell In Selection
If cell.Text <> UCase(cell.Text) Then cell.Interior.Color = vbred
Next cell
End Sub
 

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237
You could also use an InputBox() so that the user can define their own range. Example from VBA Help file:
Code:
Set myRange = Application.InputBox(prompt := "Sample", type := 8)
Hope that helps!
 

Nimrod

MrExcel MVP
Joined
Apr 29, 2002
Messages
6,259
This is a modification of tactps sol'n. In this solution you just highligt the rows or columns you want to verify. The difference in this sol'n is that only cells with values in them are looked at .... therefore greatly speeding the process up.

Sub Lcase()
For Each cell In Selection.SpecialCells(xlCellTypeConstants, 3)
If cell.Text <> UCase(cell.Text) Then cell.Interior.Color = vbRed
Next cell
End Sub
 

XLML

Active Member
Joined
Aug 15, 2003
Messages
407
Thanks for all the replies. How do I have a message box appear at the end with a count of cells identified?

XLML
 

Nimrod

MrExcel MVP
Joined
Apr 29, 2002
Messages
6,259
Sub Lcase()
C = 0
For Each cell In Selection.SpecialCells(xlCellTypeConstants, 3)
If cell.Text <> UCase(cell.Text) Then cell.Interior.Color = vbRed
C = C + 1
Next cell
pt = MsgBox("Total Found " & C, vbInformation, "Found Cells")
End Sub
 

Forum statistics

Threads
1,147,846
Messages
5,743,518
Members
423,801
Latest member
paulj4177

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top