Question: Is it possible to write a macro which would highlight any duplicate values in column A? Answer: Let's take a look at an example. Download Excel spreadsheet (as demonstrated below)
|
In our spreadsheet, we've set up column A to contain unique values. On this sheet, we've created a button that when clicked will launch a macro. This macro will highlight any duplicate values in column A. In our example, we've clicked on the button. Now the background color of the duplicates will turn red as follows:
|
In this example, the same value has been entered in both cells A2 and A5. You can press Alt-F11 to view the VBA code. Please note that the LRows variable in this macro is set to 200 indicating that the macro will test the first 200 rows in column A for duplicates. You may need to change this value to accommodate your volume of data. Macro Code:The macro code looks like this:
|
Visit our busy book shop, were you can find latest books for beginners as well as advanced excel users.
Spreadsheet 123 Spreadsheet Software Development
See Spreadsheets for:
a.Hotel Management b.Personal Budget
c.Corporate Finance d.Rating Calculation e.Real Estate and Mortgage
f.Web Calc