Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Highlight row a random color
Visual Basic 6.3/Excel 2003/XP
(Function Question 1) Column A- has many different ticket numbers sometimes duplicated. Can I create code to have all duplicated ticket numbers highlighted a random color? Then hightlight the entire row whatever color that is? For ex: I would like 1456 on both rows to be any random color that will continue from Column A to Column F. Column A Column B ... Column F 1456 NMS Work in Progress 1489 BO Scheduled 1456 Staffed New 1789 NMS Scheduled (Function Question 2) Column D has date and time. What code will color the entire row that matches date and time? For ex: 5/1/2008 9:00 make this entire row from 1456 (Column A) xColor & 1789 (Column A) That same color. Column A... Column D ... Column F 1456 5/1/2008 9:00 Work in Progress 1489 5/8/2008 19:00 Scheduled 1456 5/30/2008 3:00 New 1789 5/1/2008 9:00 Scheduled Thank you for your time.... -Altan |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Highlight row a random color
Try this small macro:
Sub altan() n = Cells(Rows.Count, "A").End(xlUp).Row v1 = 1 v2 = 56 Set r = Range("A:A") For i = 1 To n Set r2 = Cells(i, 1) m = Application.WorksheetFunction.CountIf(r, r2) If m 1 Then p = Int(((v2 - v1 + 1) * Rnd) + v1) Cells(i, 1).EntireRow.Interior.ColorIndex = p End If Next End Sub -- Gary''s Student - gsnu200787 "Altan" wrote: Visual Basic 6.3/Excel 2003/XP (Function Question 1) Column A- has many different ticket numbers sometimes duplicated. Can I create code to have all duplicated ticket numbers highlighted a random color? Then hightlight the entire row whatever color that is? For ex: I would like 1456 on both rows to be any random color that will continue from Column A to Column F. Column A Column B ... Column F 1456 NMS Work in Progress 1489 BO Scheduled 1456 Staffed New 1789 NMS Scheduled (Function Question 2) Column D has date and time. What code will color the entire row that matches date and time? For ex: 5/1/2008 9:00 make this entire row from 1456 (Column A) xColor & 1789 (Column A) That same color. Column A... Column D ... Column F 1456 5/1/2008 9:00 Work in Progress 1489 5/8/2008 19:00 Scheduled 1456 5/30/2008 3:00 New 1789 5/1/2008 9:00 Scheduled Thank you for your time.... -Altan |
#3
|
|||
|
|||
Quote:
Hey Gary"s... I love the script but have one question/request. When I ran it-it highlighted each duplicate a different color. Is there any way to have it randomly color each SET of duplicates? thanks, -h |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
highlight color in cells | New Users to Excel | |||
highlight color of duplicate numbers | Excel Discussion (Misc queries) | |||
How do I change the color of the tracking in Highlight Changes? | Excel Discussion (Misc queries) | |||
How Excel 2003 Highlight random cells and running tally appear? | Excel Discussion (Misc queries) | |||
filter by color or highlight | Excel Worksheet Functions |