Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default change row color according to an if statement

Hi

I got a user that will paste information into an excel sheet.(sheet 1)

i have alreday recorded a macro (probably need to record a new one)
that copies the format from sheet 2 and paste it onto sheet one.
Sheet 2 is already row conditional formated to row 1000.

This works but its a bit slow.

So i was wondering to use something like this (see below).

But as im a newbie to programing so i dont know how to change the "Select
Case
LCase(Target.Value)" to an if statement and that the change macro should only
be applied up to and incl. the last row of information.

thank you,

Sten

---------------------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'David McRitchie, 2004-09-26, programming, Case -- Entire Row
' http://www.mvps.org/dmcritchie/excel/event.htm#case
If Target.Column < 6 Then Exit Sub 'Column F is column 6
If Target.Row = 1 Then Exit Sub
Application.EnableEvents = False 'should be part of Change macro
Select Case LCase(Target.Value)
Case "yes"
Target.EntireRow.Interior.ColorIndex = 34
Case "no"
Target.EntireRow.Interior.ColorIndex = 36
Case Else
Target.EntireRow.Interior.ColorIndex = xlColorIndexAutomatic
End Select
Application.EnableEvents = True 'should be part of Change macro
End Su
----------------------------------------------------------------------------------------------

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
Change cell color for valid if statement Chris H Excel Discussion (Misc queries) 3 April 2nd 23 07:32 PM
if statement to change color of text mikesteven Excel Worksheet Functions 1 March 13th 08 04:26 PM
Change background color with IF statement DarrenMPY Excel Worksheet Functions 2 July 26th 06 09:58 PM
Change Color on an IF statement craigwojo Excel Worksheet Functions 0 November 8th 04 02:55 AM
Change Color on an IF statement craigwojo Excel Worksheet Functions 1 November 8th 04 12:14 AM


All times are GMT +1. The time now is 11:06 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"