Excel-count character in cel

For a column I want to highlight cell that are more then 40 character ? The macro should work for a column only and not whole worksheet.

thak you for your help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Version of Excel?
Saqib Husain, SyedEngineerCommented:
This will do it for the column in which the cursor is

Sub highlightlong()
For Each cel In ActiveCell.EntireColumn.Cells
If Len(cel.Value) > 40 Then cel.Interior.ColorIndex = 6
Next cel
End Sub

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can do this with conditional formatting.

1. Highlight the cells where you want it
2. choose "Format - Conditional Formatting"
3. Change condition1 to say "Formula Is"
4. Type in "=LEN(A2)>40" (without the quotes & replace "A2" with the first cell in your column)
5. Choose a format by clicking on the format button
6. Press OK
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

You can do it simply by using a Conditional Formatting on that column with a rule where you put a formula like this:


Please take a look at the attached image and sample file.

Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
I've requested that this question be closed as follows:

Accepted answer: 500 points for answer_dude's comment http:/Q_27032341.html#35741519

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Saqib Husain, SyedEngineerCommented:
The OP asked for a macro so that is what I gave. I should at least get a split....unless the OP changes his mind.
Saqib Husain, SyedEngineerCommented:
As above
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.