Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Junior Member
 
Posts: 1
Default

Quote:
Originally Posted by Gary''s Student View Post
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
[/i][/color]
********************************************
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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
highlight color in cells lacy New Users to Excel 7 June 17th 08 02:59 PM
highlight color of duplicate numbers Pammy Excel Discussion (Misc queries) 0 January 23rd 07 01:59 PM
How do I change the color of the tracking in Highlight Changes? Felisa Excel Discussion (Misc queries) 0 July 25th 06 06:56 PM
How Excel 2003 Highlight random cells and running tally appear? PULIDOC Excel Discussion (Misc queries) 1 April 28th 06 12:29 AM
filter by color or highlight Javid Excel Worksheet Functions 1 February 14th 05 11:22 AM


All times are GMT +1. The time now is 07:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"