Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Count funtion

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Yossy - 12 May 2008 04:08 GMT
Please I have a column of middle names. Most middle names are 1 character and
some are more than 1 character. Is there a formula that can help me know if
some middle names are more than 1 character and possible highlight or color.

All help totally appreciated.
Gary Keramidas - 12 May 2008 05:05 GMT
if they're all in a separate column, maybe this will help. i used sheet1 and
column B in my example.

Sub test()
     Dim ws As Worksheet
     Dim lastrow As Long
     Dim rng As Range
     Dim cell As Range
     Dim cntr As Long
     Set ws = Worksheets("Sheet1")
     lastrow = ws.Cells(Rows.Count, "B").End(xlUp).Row
     Set rng = ws.Range("b2:B" & lastrow)

     For Each cell In rng
           If Len(cell) > 1 Then
                 cell.Interior.ColorIndex = 19
                 cntr = cntr + 1
           Else
           cell.Interior.ColorIndex = 0
           End If
     Next
MsgBox cntr & " names with more than 1 character."
End Sub

Signature

Gary

> Please I have a column of middle names. Most middle names are 1 character and
> some are more than 1 character. Is there a formula that can help me know if
> some middle names are more than 1 character and possible highlight or color.
>
> All help totally appreciated.
JW - 12 May 2008 15:24 GMT
> Please I have a column of middle names. Most middle names are 1 character and
> some are more than 1 character. Is there a formula that can help me know if
> some middle names are more than 1 character and possible highlight or color.
>
> All help totally appreciated.

You can use Conditional Formatting.  Highlight the range of cells
containing the middle names.  Choose Tools|Conditional Formatting.
Select "Formula Is" from the drop down box and place this formula in
the textbox (assuming column D contains the middle names).
=LEN(D2)>1

Then click the Format button and change the formatting that will be
displayed if the length is greater than 1.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.