Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default changing row color

Hi,
I would like to change the row color according to an if statement.

if column A is bigger than column B than change the row color to blue
otherwise no change should occur. (i.e. if A1B1, A2B2, A3B3)

The change is on pre-existing data.

thank you,

Sten Melin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default changing row color

Select all of the rows, starting from 1

FormatConditional Formatting

Change Condition 1 to Formula Is
Add a Formula of =$A1$B1
Click format
Select Pattern
Choose a colour
OK out

--

HTH

RP
(remove nothere from the email address if mailing direct)


"converting 05445 to 2005-10-04"
om wrote in message
...
Hi,
I would like to change the row color according to an if statement.

if column A is bigger than column B than change the row color to blue
otherwise no change should occur. (i.e. if A1B1, A2B2, A3B3)

The change is on pre-existing data.

thank you,

Sten Melin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default changing row color

Thanks for your help and time Bob!

I did not quite express myself clearly.

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 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.

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 Sub
----------------------------------------------------------------------------------------------



"Bob Phillips" skrev:

Select all of the rows, starting from 1

FormatConditional Formatting

Change Condition 1 to Formula Is
Add a Formula of =$A1$B1
Click format
Select Pattern
Choose a colour
OK out

--

HTH

RP
(remove nothere from the email address if mailing direct)


"converting 05445 to 2005-10-04"
om wrote in message
...
Hi,
I would like to change the row color according to an if statement.

if column A is bigger than column B than change the row color to blue
otherwise no change should occur. (i.e. if A1B1, A2B2, A3B3)

The change is on pre-existing data.

thank you,

Sten Melin




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
Changing Row Color Gs Excel Discussion (Misc queries) 13 September 3rd 09 03:39 AM
Changing color of a row David G[_2_] Excel Discussion (Misc queries) 3 July 20th 07 09:12 PM
Changing Tab Color With VBA Minitman[_4_] Excel Programming 10 July 30th 05 01:49 AM
Changing color in color palette Dave Peterson Setting up and Configuration of Excel 0 December 12th 04 02:39 PM
changing bg color kraft Excel Programming 2 April 1st 04 06:08 PM


All times are GMT +1. The time now is 12:42 PM.

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

About Us

"It's about Microsoft Excel"