How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Richard Your Own Question

Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 30174
Experience:  Over 15 year experience resolving Microsoft Office Issues
Type Your Microsoft Office Question Here...
Richard is online now
A new question is answered every 9 seconds

Problem: Excel wont select cells based on format. Procedure

This answer was rated:

Problem: Excel won't select cells based on format.

Procedure is as follows: (1) In Conditional Formatting, format all cells in List 1 that are equal to any cell in List 2 using a Countif formula (Format = yellow fill color). (2) Click on a cell with yellow fill. (3) In Find & Select - Go To Special - Contitional Formats - Data Validation - Select Same. (4) Click OK.

Excel highlights all cells, not just the yellow fill cells.
Thank you for your question, my name is Richard.

So to clarify, you want Excel to highlight the block of cells that have a yellow fill color correct?

Customer: replied 3 years ago.

I want Excel to highlight only those cells (not necessarily in a "block") with the format that I've caused Excel to apply via conditional formatting. The nature of the format is irrelevant.

Ok, it is relevant though as this is going to need a Macro.

What formating should it be highlighting on?

Customer: replied 3 years ago.

I'm trying to select cells in List 1 that contain nuymbers equal to the cells in List 2. I'm trying to do this using conditional formatting. The format used is irrelevant.
Maybe you should call me. My number is XXXXX Ext 270.

I cannot call sorry.

But basically you will do your conditional formating.

Then you want the formatted cells to be selected correct?

Customer: replied 3 years ago.

Correct. In Conditional Formats, when I click OK after selecting Same under Data Validation, Excel selects all cells in the List, not just the cells containing the selected format.


I could send you the esperimenta spreadsheet if this would help.

It would, but this needs to be done with a Macro, thats the only way to achieve this, but you keep saying

The format used is irrelevant.

But it is relevant, as the Macro needs to know the format your going to use. So unless you keep saying this, it will not be possible to do.

Customer: replied 3 years ago.

OK. I understand.


By "it would" do you mean that Excel would select all cells or that sending the experimental spreadsheet would help?


I tried to attach the spreadsheet to this reply, but it appears to accept only images.

Sending the sheet will help

But I need you to tell me what formatting you will use and on which sheet.

To give me the sheet

- Click the following link:
- Upload the file to that website
- Once it is uploaded, the resulting page will display a "File ID" number.
- Please, give me that "File ID Number"

Thank you
Customer: replied 3 years ago.

Yellow fill is OK for the format.

I will need to be able to do this on any sheet I specify.


The file ID is 285830.


FYI, I have limited experience with Excel macros.

Ok, this is done.

You can download the file from under File ID 483074

I have made a button, so you click this button when you want the Cells with Yello to be selected.

If you have any difficulties at all, please do not hesitate to let me know so I can assist you further

Thank you
Customer: replied 3 years ago.

Sorry, but I can't figure out how to open the file I downloaded from Wikisend.
I found some xml documents, but no Excel documents.

Which version of Excel are you using?
Customer: replied 3 years ago.


ok, is the same version as me.

I uploaded again in a Zip File

ID is 755544

When you download, right click on it and Extract the Excel file, then run it.

Let me know the results please

Thank you
Customer: replied 3 years ago.

I tried it, and it selectes the cells you cormatted, but doesn't select the cell I selected via conditional formatting.


Also, how can I transfer the button to other spreadsheets?

First, send me the sheet again with your conditional formatting applied.

As I want to see what the issue is.

Customer: replied 3 years ago.

I tried to upload the file, and it briefly opened the file ID enter window, then closed it and opened the download window before I could enter an ID number.

You dont enter an ID Number, it gives you one on the download window.

Look there for it and give it to me please.

Customer: replied 3 years ago.

Sorry. It's on its way.

No problem
Customer: replied 3 years ago.

The number is XXXXX


Test this file please


Let me know the results please

Customer: replied 3 years ago.

I tried tried adding a non-conditional format to the conditional format. Neither formatted cell was selected when the putton was pushed.


The file ID number is XXXXX

Can you give me the formula you use for the conditional format please

Customer: replied 3 years ago.

=COUNTIF(List2:B2)>0 (B2 is the first cell in List1.) The formula identifies all cells in List1 that produce a TRUE result.

ok, got it


It only does it on cells highlighted via Conditional formatting, not ones you manually highlight.

Customer: replied 3 years ago.

It works!


As I indicated above, I need to be able to apply this to any spreadsheet I select. How can I do this?

ok, you need to copy the Macro to the other sheets / files.

to do this, follow these steps.

In this sheet, press Alt+F11

A new window opens.

double click on the left in Project, Sheet 1

you will see the sub Macro2()

Copy all that text as this is the code.

Then go to the sheet you want to run this on.

Press ALT+F11

Double click the sheet in the Project window top left

Paste the code there and then to run it press F5

this will run the code.

If you want to run it using a button, first unhide the developers tab

To unhide it

Click the File tab.
Click Options.
Click Customize Ribbon.
Under Customize the Ribbon and under Main Tabs, select the Developer check box.

Then click on the Developer Tab

Click Insert, then choose the first one (button)

Draw it on the sheet.

Then assign it to Macro 2 when the window appear.

Then you can run it via the button.

If you have any problems, or would like any additional information or assistance, please do not hesitate to let me know.

And if you can take a second to rate my service, that would be greatly appreciated.

Thank you
Richard and 3 other Microsoft Office Specialists are ready to help you