Thank you for replying. I would like to support you. But, I have to apologize for my poor English skill, again. Unfortunately, I cannot still understand your question. But I would like to try to understand it. When I could correctly understand it, I would like to think of a solution. I would be grateful if you can forgive my poor English skill.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/7ef3fe5e-577c-407f-b1d4-42262179c983n%40googlegroups.com.
Thank you for replying. I would like to support you. But, I have to apologize for my poor English skill, again. Unfortunately, I cannot still understand your question. But I would like to try to understand it. When I could correctly understand it, I would like to think of a solution. I would be grateful if you can forgive my poor English skill.
--
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/4Ynv-0tbZ2Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAANZsGOzmt9uVt_QrMvVNY-N3ZpaZFGPnR%2BAzfBGw%2B6Dr4%2ByvQ%40mail.gmail.com.
I updated the script to only highlight the cells in Column C or E if dups and to skip over blank cells.
Here is the code: (just paste it over what you have and save it). Then you can run it from the Custom menu.
/**
* Finds duplicate rows in the active sheet and colors them red,
but only pays attention to the indicated columns.
*/
function findDuplicates() {
// List the columns you want to check by number (A = 1)
var CHECK1 = 2; // Column C
var CHECK2 = 4; // Column E
// Get the active sheet and info about it
var sourceSheet = SpreadsheetApp.getActiveSheet();
var numRows = sourceSheet.getLastRow(); //return total row integer
var numCols = sourceSheet.getLastColumn(); // return total column integer
// Find duplicates in the FindDupes sheet and color them in the main sheet
var data = sourceSheet.getDataRange().getValues();
for (i = 1; i < data.length - 1; i++)
{
for (j = i+1; j < data.length; j++) {
if (data[i][CHECK1] == "") {continue;}
if (data[i][CHECK1] == data[j][CHECK2]) {
sourceSheet.getRange(i+1,CHECK1+1).setBackground("red");
sourceSheet.getRange(j+1,CHECK2+1).setBackground("red");
}
}
}
};
/**
* Adds a custom menu to the active spreadsheet
*/
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Find Duplicates",
functionName : "findDuplicates"
}];
sheet.addMenu("Custom Menu", entries);
};
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CACkFDNZDnycZgq%2B_MMviQJEB0KhuQMB5HaMAzEDAhUvjENsu1w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/789e7c92-08c0-4f41-93d8-8cc2d245320bn%40googlegroups.com.