#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Row Color

I am looking to change a printable area row if a condition is true such as :

If any cell or cells within the range of AL6:AL16 contains an "A" then
change the row containing that "A" (Only the printable area) to the color
orange. If not leave as is

Is this possable?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Row Color

How would we know the printable area? How are you defining it?

--
Regards,
Tom Ogilvy



"ParTeeGolfer" wrote in message
...
I am looking to change a printable area row if a condition is true such

as :

If any cell or cells within the range of AL6:AL16 contains an "A" then
change the row containing that "A" (Only the printable area) to the color
orange. If not leave as is

Is this possable?



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

Tom,

The printable areas are Page 1 - is B6:P16 and page 2 is S6:AH16

Thanks Tom

"Tom Ogilvy" wrote:

How would we know the printable area? How are you defining it?

--
Regards,
Tom Ogilvy





"ParTeeGolfer" wrote in message
...
I am looking to change a printable area row if a condition is true such

as :

If any cell or cells within the range of AL6:AL16 contains an "A" then
change the row containing that "A" (Only the printable area) to the color
orange. If not leave as is

Is this possable?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Row Color

Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in message
...
Tom,

The printable areas are Page 1 - is B6:P16 and page 2 is S6:AH16

Thanks Tom

"Tom Ogilvy" wrote:

How would we know the printable area? How are you defining it?

--
Regards,
Tom Ogilvy





"ParTeeGolfer" wrote in message
...
I am looking to change a printable area row if a condition is true

such
as :

If any cell or cells within the range of AL6:AL16 contains an "A"

then
change the row containing that "A" (Only the printable area) to the

color
orange. If not leave as is

Is this possable?






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

Tom I tried to copy and past into a module, however I got and "Invalid
outside procedure " error. Do I need a Function prior to the Dim Statement?

"Tom Ogilvy" wrote:

Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in message
...
Tom,

The printable areas are Page 1 - is B6:P16 and page 2 is S6:AH16

Thanks Tom

"Tom Ogilvy" wrote:

How would we know the printable area? How are you defining it?

--
Regards,
Tom Ogilvy





"ParTeeGolfer" wrote in message
...
I am looking to change a printable area row if a condition is true

such
as :

If any cell or cells within the range of AL6:AL16 contains an "A"

then
change the row containing that "A" (Only the printable area) to the

color
orange. If not leave as is

Is this possable?








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


Nevermind the comment about the error, I got the VBA to work, However I have
numerous sheets for this to cover and it seems the way it is written now, the
only way it will work is to open each sheet. Is there a way to have is run on
all sheets as soon as the workbook is open?

Once again Thanks for your time!

"ParTeeGolfer" wrote:

Tom I tried to copy and past into a module, however I got and "Invalid
outside procedure " error. Do I need a Function prior to the Dim Statement?

"Tom Ogilvy" wrote:

Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in message
...
Tom,

The printable areas are Page 1 - is B6:P16 and page 2 is S6:AH16

Thanks Tom

"Tom Ogilvy" wrote:

How would we know the printable area? How are you defining it?

--
Regards,
Tom Ogilvy





"ParTeeGolfer" wrote in message
...
I am looking to change a printable area row if a condition is true

such
as :

If any cell or cells within the range of AL6:AL16 contains an "A"

then
change the row containing that "A" (Only the printable area) to the

color
orange. If not leave as is

Is this possable?






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Row Color

Sub MyMacro()
Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in message
...
Tom I tried to copy and past into a module, however I got and "Invalid
outside procedure " error. Do I need a Function prior to the Dim

Statement?

"Tom Ogilvy" wrote:

Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in message
...
Tom,

The printable areas are Page 1 - is B6:P16 and page 2 is S6:AH16

Thanks Tom

"Tom Ogilvy" wrote:

How would we know the printable area? How are you defining it?

--
Regards,
Tom Ogilvy





"ParTeeGolfer" wrote in

message
...
I am looking to change a printable area row if a condition is

true
such
as :

If any cell or cells within the range of AL6:AL16 contains an "A"

then
change the row containing that "A" (Only the printable area) to

the
color
orange. If not leave as is

Is this possable?








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

Is there anyway I can have this macro run automatically when the workbook is
open for each sheet in the workbook?

"Tom Ogilvy" wrote:

Sub MyMacro()
Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in message
...
Tom I tried to copy and past into a module, however I got and "Invalid
outside procedure " error. Do I need a Function prior to the Dim

Statement?

"Tom Ogilvy" wrote:

Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in message
...
Tom,

The printable areas are Page 1 - is B6:P16 and page 2 is S6:AH16

Thanks Tom

"Tom Ogilvy" wrote:

How would we know the printable area? How are you defining it?

--
Regards,
Tom Ogilvy





"ParTeeGolfer" wrote in

message
...
I am looking to change a printable area row if a condition is

true
such
as :

If any cell or cells within the range of AL6:AL16 contains an "A"
then
change the row containing that "A" (Only the printable area) to

the
color
orange. If not leave as is

Is this possable?









  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Row Color

Private Sub Workbooks_Open()
Dim cell as Range, rng as Range
Dim sh as Worksheet
for each sh in ThisWorkbook.Worksheets
for each cell in sh.Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(sh.Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next
Next
End Sub

go to the VBE and in the project explorer, double click on the ThisWorkbook
entry in your project. In the resulting module, in the left drodown (at
the top) select Workbook and in the right select Open. This is where you
want to place the code so it looks like the above.

--
Regards,
Tom Ogilvy


"ParTeeGolfer" wrote in message
...
Is there anyway I can have this macro run automatically when the workbook

is
open for each sheet in the workbook?

"Tom Ogilvy" wrote:

Sub MyMacro()
Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in message
...
Tom I tried to copy and past into a module, however I got and "Invalid
outside procedure " error. Do I need a Function prior to the Dim

Statement?

"Tom Ogilvy" wrote:

Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in

message
...
Tom,

The printable areas are Page 1 - is B6:P16 and page 2 is S6:AH16

Thanks Tom

"Tom Ogilvy" wrote:

How would we know the printable area? How are you defining it?

--
Regards,
Tom Ogilvy





"ParTeeGolfer" wrote in

message
...
I am looking to change a printable area row if a condition

is
true
such
as :

If any cell or cells within the range of AL6:AL16 contains an

"A"
then
change the row containing that "A" (Only the printable area)

to
the
color
orange. If not leave as is

Is this possable?











  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Row Color

Thanks Tom,

this is exactly what I was looking for.

"Tom Ogilvy" wrote:

Private Sub Workbooks_Open()
Dim cell as Range, rng as Range
Dim sh as Worksheet
for each sh in ThisWorkbook.Worksheets
for each cell in sh.Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(sh.Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next
Next
End Sub

go to the VBE and in the project explorer, double click on the ThisWorkbook
entry in your project. In the resulting module, in the left drodown (at
the top) select Workbook and in the right select Open. This is where you
want to place the code so it looks like the above.

--
Regards,
Tom Ogilvy


"ParTeeGolfer" wrote in message
...
Is there anyway I can have this macro run automatically when the workbook

is
open for each sheet in the workbook?

"Tom Ogilvy" wrote:

Sub MyMacro()
Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in message
...
Tom I tried to copy and past into a module, however I got and "Invalid
outside procedure " error. Do I need a Function prior to the Dim
Statement?

"Tom Ogilvy" wrote:

Dim cell as Range, rng as Range
for each cell in Range("AL6:AL16")
if cell.Value = "A" then
set rng = Intersect(Range("B6:P16, S6:AH16"), _
cell.EntireRow)
rng.Interior.ColorIndex = 45
end if
Next

--
Regards,
Tom Ogilvy

"ParTeeGolfer" wrote in

message
...
Tom,

The printable areas are Page 1 - is B6:P16 and page 2 is S6:AH16

Thanks Tom

"Tom Ogilvy" wrote:

How would we know the printable area? How are you defining it?

--
Regards,
Tom Ogilvy





"ParTeeGolfer" wrote in
message
...
I am looking to change a printable area row if a condition

is
true
such
as :

If any cell or cells within the range of AL6:AL16 contains an

"A"
then
change the row containing that "A" (Only the printable area)

to
the
color
orange. If not leave as is

Is this possable?












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
Powerpoint / Excel: custom pp RGB color doesn't match identical Excelcustom RGB color mikewillnot Charts and Charting in Excel 1 February 26th 08 05:22 PM
Can't format cell color/text color in Office Excel 2003 in files . albertaman Excel Discussion (Misc queries) 0 February 16th 06 03:56 AM
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
Browse Forms Controls and change TextBox color based on cell color StefanW Excel Programming 2 November 21st 04 07:06 PM


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