ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Row Color (https://www.excelbanter.com/excel-programming/321952-row-color.html)

ParTeeGolfer

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?

Tom Ogilvy

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?




ParTeeGolfer

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?





Tom Ogilvy

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?







ParTeeGolfer

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?







ParTeeGolfer

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?







Tom Ogilvy

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?









ParTeeGolfer

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?










Tom Ogilvy

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?












ParTeeGolfer

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?














All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com