Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Nexan
 
Posts: n/a
Default How can I search for words in all caps in Excel?

As part of a macro, I'd like to be able to identify and re-format only cells
containing words in all caps. Is that doable?

Thanks!
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format only cells
containing words in all caps. Is that doable?

Thanks!

  #3   Report Post  
Nexan
 
Posts: n/a
Default

Okay, I've hit a snag with this. I just realized that this script only seems
to be finding cells containing nothing but letters in all caps. Is there a
way to find cells containing some words in all caps and some in
upper/lowercase?

"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format only cells
containing words in all caps. Is that doable?

Thanks!

  #4   Report Post  
Nick
 
Posts: n/a
Default

You could use LCASE or the Like operator.

Nick


"Nexan" wrote in message
...
Okay, I've hit a snag with this. I just realized that this script only
seems
to be finding cells containing nothing but letters in all caps. Is there a
way to find cells containing some words in all caps and some in
upper/lowercase?

"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format only
cells
containing words in all caps. Is that doable?

Thanks!



  #5   Report Post  
Nexan
 
Posts: n/a
Default

Could you possibly give me an example of that?

Thanks!

"Nick" wrote:

You could use LCASE or the Like operator.

Nick


"Nexan" wrote in message
...
Okay, I've hit a snag with this. I just realized that this script only
seems
to be finding cells containing nothing but letters in all caps. Is there a
way to find cells containing some words in all caps and some in
upper/lowercase?

"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format only
cells
containing words in all caps. Is that doable?

Thanks!






  #6   Report Post  
Nick
 
Posts: n/a
Default


Don't know what information you have in your cells but something like this
could be used

For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
ElseIf cell.Value = LCase(Cell.Value) then
cell.Font.ColorIndex = 3 'make font color = red
ElseIf cell.Value = application.Proper(cell.Value) ' Matches if Proper
case, capital for each word eg This Is The End
ElseIf cell.VAlue like "[A-Z]*[A-Z]*"' Matched is Capital at start and
Capital some where in the text
'Code here
ElseIf cell.Value like "[A-Z]*" ' Matches value if it starts with a
capital letter
' Code here

End If
Next

Look in the help for examples of the Like Operator
Also not that for the Like Operator to Match Upper case letters you must
specify Option Compare Binary at the top of the module. If you Don't then
the case of the letters is ignored, i.e. A=a etc.

Hope this is useful

Nick


"Nexan" wrote in message
...
Could you possibly give me an example of that?

Thanks!

"Nick" wrote:

You could use LCASE or the Like operator.

Nick


"Nexan" wrote in message
...
Okay, I've hit a snag with this. I just realized that this script only
seems
to be finding cells containing nothing but letters in all caps. Is
there a
way to find cells containing some words in all caps and some in
upper/lowercase?

"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format
only
cells
containing words in all caps. Is that doable?

Thanks!






  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default How can I search for words in all caps in Excel?

Hi Jason
I have found this old script and yes it works for me, However is it possible
to have an addition part so that in addition to the Red colour, addtional
text text is added to another column.
Eg say the selection is in Column A, if the CAPS word is found in cell A2
then B2 has '1' placed in it. This would allow a filter to be setup on Col B.

Many thanks for any help


"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format only cells
containing words in all caps. Is that doable?

Thanks!

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default How can I search for words in all caps in Excel?

Try this:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
If cell.Value < "" Then
cell.Font.ColorIndex = 3 'make font color = red
cell.Offset(0, 1).Value = 1
End If
End If
Next
End Sub

--
Biff
Microsoft Excel MVP


"NoelH" wrote in message
...
Hi Jason
I have found this old script and yes it works for me, However is it
possible
to have an addition part so that in addition to the Red colour, addtional
text text is added to another column.
Eg say the selection is in Column A, if the CAPS word is found in cell A2
then B2 has '1' placed in it. This would allow a filter to be setup on Col
B.

Many thanks for any help


"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format only
cells
containing words in all caps. Is that doable?

Thanks!



  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How can I search for words in all caps in Excel?

Not Jason but here's a revision of his code.

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
With cell
.Font.ColorIndex = 3 'make font color = red
.Offset(0, 1).Value = 1
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Tue, 27 Nov 2007 15:55:01 -0800, NoelH
wrote:

Hi Jason
I have found this old script and yes it works for me, However is it possible
to have an addition part so that in addition to the Red colour, addtional
text text is added to another column.
Eg say the selection is in Column A, if the CAPS word is found in cell A2
then B2 has '1' placed in it. This would allow a filter to be setup on Col B.

Many thanks for any help


"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format only cells
containing words in all caps. Is that doable?

Thanks!




  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default How can I search for words in all caps in Excel?

Hi T.

many thanks for the help, yes it worked
Noel


"T. Valko" wrote:

Try this:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
If cell.Value < "" Then
cell.Font.ColorIndex = 3 'make font color = red
cell.Offset(0, 1).Value = 1
End If
End If
Next
End Sub

--
Biff
Microsoft Excel MVP


"NoelH" wrote in message
...
Hi Jason
I have found this old script and yes it works for me, However is it
possible
to have an addition part so that in addition to the Red colour, addtional
text text is added to another column.
Eg say the selection is in Column A, if the CAPS word is found in cell A2
then B2 has '1' placed in it. This would allow a filter to be setup on Col
B.

Many thanks for any help


"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format only
cells
containing words in all caps. Is that doable?

Thanks!




  #13   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default How can I search for words in all caps in Excel?

Hi Gord
Thanks for the help
Yes this worked too.
Noel

"Gord Dibben" wrote:

Not Jason but here's a revision of his code.

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
With cell
.Font.ColorIndex = 3 'make font color = red
.Offset(0, 1).Value = 1
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Tue, 27 Nov 2007 15:55:01 -0800, NoelH
wrote:

Hi Jason
I have found this old script and yes it works for me, However is it possible
to have an addition part so that in addition to the Red colour, addtional
text text is added to another column.
Eg say the selection is in Column A, if the CAPS word is found in cell A2
then B2 has '1' placed in it. This would allow a filter to be setup on Col B.

Many thanks for any help


"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format only cells
containing words in all caps. Is that doable?

Thanks!



  #14   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default How can I search for words in all caps in Excel?

You're welcome. Thanks for the feedback!

Note that I added a test for empty cells. The other replies did not. An
empty cell would get a 1. (if you might have empty cells in the range)

--
Biff
Microsoft Excel MVP


"NoelH" wrote in message
...
Hi T.

many thanks for the help, yes it worked
Noel


"T. Valko" wrote:

Try this:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
If cell.Value < "" Then
cell.Font.ColorIndex = 3 'make font color = red
cell.Offset(0, 1).Value = 1
End If
End If
Next
End Sub

--
Biff
Microsoft Excel MVP


"NoelH" wrote in message
...
Hi Jason
I have found this old script and yes it works for me, However is it
possible
to have an addition part so that in addition to the Red colour,
addtional
text text is added to another column.
Eg say the selection is in Column A, if the CAPS word is found in cell
A2
then B2 has '1' placed in it. This would allow a filter to be setup on
Col
B.

Many thanks for any help


"Jason Morin" wrote:

Select your data and run this macro:

Sub OnlyUpper()
Dim cell As Range
For Each cell In Selection
If cell.Value = UCase(cell.Value) Then
cell.Font.ColorIndex = 3 'make font color = red
End If
Next
End Sub

---
HTH
Jason
Atlanta, GA


"Nexan" wrote:

As part of a macro, I'd like to be able to identify and re-format
only
cells
containing words in all caps. Is that doable?

Thanks!






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
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
How do I search for a string across multiple worksheets in Excel? BBiletch Excel Worksheet Functions 2 April 5th 05 11:59 PM
how to search in excel with condition David Excel Discussion (Misc queries) 1 February 8th 05 09:23 PM
How do I search for an asterisk in an Excel file--it thinks the a. ace Excel Discussion (Misc queries) 3 December 9th 04 04:23 PM
Excel - Formula Query: Search for and Return Value Sue Excel Worksheet Functions 3 December 7th 04 12:35 AM


All times are GMT +1. The time now is 01:16 PM.

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

About Us

"It's about Microsoft Excel"