Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Help Fixing Coloring Macro

Here is my Macro:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
If Target.Cells.Count 1 Then Exit Sub
If Target.Value = "Y" Then
Range(Cells(Target.Row, "A"), Cells(Target.Row, "C")) _
..Interior.Color = RGB(204, 255, 204)
Else
Range(Cells(Target.Row, "A"), Cells(Target.Row, "C")) _
..Interior.Color = RGB(255, 255, 255)
End If
End If
End Sub

Three things I would like to adjust on it.

1) I would like this to only effect rows 23 and lower

2) I would like the "Y" criteria not to be case sensitive

3) The Else is set to 255, 255, 255 (white) but is there a setting for
just no color at all?


Thanks for any help,


Tyson

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help Fixing Coloring Macro

By 23 and lower do you mean 23, 24, 25 etc. That is my assumption.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then.
If Target.Cells.Count 1 or Target.row < 23 Then Exit Sub
If Ucase(Target.Value) = "Y" Then
Range(Cells(Target.Row, "A"), Cells(Target.Row, "C")) _
.Interior.Color = RGB(204, 255, 204)
Else
Range(Cells(Target.Row, "A"), Cells(Target.Row, "C")) _
.Interior.ColorIndex = xlNone
End If
End If
End Sub

--
Regards,
Tom Ogilvy


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Help Fixing Coloring Macro

Thanks Tom, just what I needed.

Tyson


Tom Ogilvy wrote:
By 23 and lower do you mean 23, 24, 25 etc. That is my assumption.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then.
If Target.Cells.Count 1 or Target.row < 23 Then Exit Sub
If Ucase(Target.Value) = "Y" Then
Range(Cells(Target.Row, "A"), Cells(Target.Row, "C")) _
.Interior.Color = RGB(204, 255, 204)
Else
Range(Cells(Target.Row, "A"), Cells(Target.Row, "C")) _
.Interior.ColorIndex = xlNone
End If
End If
End Sub

--
Regards,
Tom Ogilvy


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
Fixing the date format in a macro or VBA Geoff B Excel Worksheet Functions 1 September 7th 09 11:00 AM
macro for coloring in cells ob Excel Discussion (Misc queries) 1 December 20th 07 07:33 PM
Excel Macro for Coloring the cells Dhawal Excel Discussion (Misc queries) 1 October 5th 06 12:32 AM
Fixing a vlookup macro that returns #N/A error Grosvenor Excel Discussion (Misc queries) 1 February 8th 06 12:23 PM
fixing macro to highlight a row if a checkbox is checked MCB Excel Programming 1 May 22nd 04 06:31 AM


All times are GMT +1. The time now is 05:02 PM.

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"