Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Add Fill Color to Row

I've got a Macro that runs through all the rows on my page, and removes in
rows where the check value is between 0 and -5. Any row that has a check
value greater than -5 (technically less than) I want it to make the row from
column A to H Red in the background. So that the user will know to look at
that row when done.

How would I go about changing the fill color value for a row of cells?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Add Fill Color to Row

I'm not sure how you are cycling through all the rows but insert this
into the code
Assume that mCell is the expression of the cell you are checking in the
row

If mCell -5 then
mCell.EntireRow.Interior.ColorIndex = 3
End If

If you are not sure about the "mCell" expression post your code that
cycles through the rows and I'll be able to put the code in better
context.

Sandy


RSteph wrote:
I've got a Macro that runs through all the rows on my page, and removes in
rows where the check value is between 0 and -5. Any row that has a check
value greater than -5 (technically less than) I want it to make the row from
column A to H Red in the background. So that the user will know to look at
that row when done.

How would I go about changing the fill color value for a row of cells?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Add Fill Color to Row

Assuming that your code nemd the range you wanted to change as rg1.

rg1.interior.colorindex = 3

3 is red
6 is yellow

Those are the indexes I know off of the top of my head. You can use the
immediate window to discover others.

RSteph wrote:
I've got a Macro that runs through all the rows on my page, and removes in
rows where the check value is between 0 and -5. Any row that has a check
value greater than -5 (technically less than) I want it to make the row from
column A to H Red in the background. So that the user will know to look at
that row when done.

How would I go about changing the fill color value for a row of cells?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 341
Default Add Fill Color to Row

let rownumber is the number of the row which you want to colour

with range(cells(rownumber,1),cells(rownumber,8)) '1 is col A, 8 is col H
.Interior.ColorIndex = 3
.Font.ColorIndex = 2 ' sets font to white (visibility)
end with

etc etc

or you can use rows(rownumber).interior.colorindex
--
Allllen


"RSteph" wrote:

I've got a Macro that runs through all the rows on my page, and removes in
rows where the check value is between 0 and -5. Any row that has a check
value greater than -5 (technically less than) I want it to make the row from
column A to H Red in the background. So that the user will know to look at
that row when done.

How would I go about changing the fill color value for a row of cells?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Add Fill Color to Row

Made a mistake use "<" instead of ""

Sandy


RSteph wrote:
I've got a Macro that runs through all the rows on my page, and removes in
rows where the check value is between 0 and -5. Any row that has a check
value greater than -5 (technically less than) I want it to make the row from
column A to H Red in the background. So that the user will know to look at
that row when done.

How would I go about changing the fill color value for a row of cells?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Add Fill Color to Row

Here's how I'm cycling through:

Dim lastRow As Long 'Used to hold the value of last row on the sheet.
Dim i As Integer 'Used to incriment For Loop.

lastRow = Cells(Rows.Count, "G").End(xlUp).Row 'Get the last row on the page.

For i = lastRow To 1 Step -1 'Loop through to the end of the page, from
bottom up.
If Cells(i, "G").Value < 0 And Cell(i, "G").Value -5 Then
Rows(i).Delete 'Delete row.
ElseIf Cells(i, "G").Value < -5 Then
<Code Inserted Here
End If

Next i 'Increment counter and reloop


"Sandy" wrote:

I'm not sure how you are cycling through all the rows but insert this
into the code
Assume that mCell is the expression of the cell you are checking in the
row

If mCell -5 then
mCell.EntireRow.Interior.ColorIndex = 3
End If

If you are not sure about the "mCell" expression post your code that
cycles through the rows and I'll be able to put the code in better
context.

Sandy


RSteph wrote:
I've got a Macro that runs through all the rows on my page, and removes in
rows where the check value is between 0 and -5. Any row that has a check
value greater than -5 (technically less than) I want it to make the row from
column A to H Red in the background. So that the user will know to look at
that row when done.

How would I go about changing the fill color value for a row of cells?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 341
Default Add Fill Color to Row

Dim lastRow As Long
Dim i As Integer

lastRow = Cells(Rows.Count, "G").End(xlUp).Row

For i = lastRow To 1 Step -1
If Cells(i, "G").Value < 0 And Cells(i, "G").Value -5 Then
Rows(i).Delete
ElseIf Cells(i, "G").Value < -5 Then
With Range(Cells(i, 1), Cells(i, 8))
.Interior.ColorIndex = 3
.Font.ColorIndex = 2
End With
End If
Next i
--
Allllen


"RSteph" wrote:

Here's how I'm cycling through:

Dim lastRow As Long 'Used to hold the value of last row on the sheet.
Dim i As Integer 'Used to incriment For Loop.

lastRow = Cells(Rows.Count, "G").End(xlUp).Row 'Get the last row on the page.

For i = lastRow To 1 Step -1 'Loop through to the end of the page, from
bottom up.
If Cells(i, "G").Value < 0 And Cell(i, "G").Value -5 Then
Rows(i).Delete 'Delete row.
ElseIf Cells(i, "G").Value < -5 Then
<Code Inserted Here
End If

Next i 'Increment counter and reloop


"Sandy" wrote:

I'm not sure how you are cycling through all the rows but insert this
into the code
Assume that mCell is the expression of the cell you are checking in the
row

If mCell -5 then
mCell.EntireRow.Interior.ColorIndex = 3
End If

If you are not sure about the "mCell" expression post your code that
cycles through the rows and I'll be able to put the code in better
context.

Sandy


RSteph wrote:
I've got a Macro that runs through all the rows on my page, and removes in
rows where the check value is between 0 and -5. Any row that has a check
value greater than -5 (technically less than) I want it to make the row from
column A to H Red in the background. So that the user will know to look at
that row when done.

How would I go about changing the fill color value for a row of cells?



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Add Fill Color to Row

Thank you all for the suggestions on various methods of completing this task.
I got the method working perfectly for what I need.


"Sandy" wrote:

Made a mistake use "<" instead of ""

Sandy


RSteph wrote:
I've got a Macro that runs through all the rows on my page, and removes in
rows where the check value is between 0 and -5. Any row that has a check
value greater than -5 (technically less than) I want it to make the row from
column A to H Red in the background. So that the user will know to look at
that row when done.

How would I go about changing the fill color value for a row of cells?



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
color fill button is not adding color to my spread sheet mitchnmd Excel Worksheet Functions 1 September 26th 07 04:36 PM
change fill color of a range of cells based on color of a cell? DarMelNel Excel Programming 0 March 2nd 06 06:35 PM
My fill color and font color do not work in Excel Std Edition 2003 chapstick Excel Discussion (Misc queries) 1 September 11th 05 08:48 PM
Excel 2003 will not display color fonts or color fill cells DaveC Excel Worksheet Functions 1 April 11th 05 04:38 PM
My excel 2003 wont let me fill cells with color or color the tabs. trizog New Users to Excel 2 February 22nd 05 06:43 PM


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