ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Formating (https://www.excelbanter.com/excel-programming/282790-cell-formating.html)

MWilliams

Cell Formating
 

I am trying to write a macro that will look at a cell in one workshee
to determine the fill color of a specified range on an othe
worksheet.

example:
if cell A1 in sheet1 = 0 then the fill color for sheet2 cells b2:d
will be red.

Thank

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


Anders S

Cell Formating
 
Hi,

One way without a macro, is to use Conditional formatting on Sheet2, cells B2:D2 with a formula like
=nCell=0
where nCell is a named reference to Sheet1, A1.

HTH
Anders Silvén

"MWilliams" skrev i meddelandet ...

I am trying to write a macro that will look at a cell in one worksheet
to determine the fill color of a specified range on an other
worksheet.

example:
if cell A1 in sheet1 = 0 then the fill color for sheet2 cells b2:d2
will be red.

Thanks


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


mudraker[_19_]

Cell Formating
 

If worksheets("Sheet1").range("a1").value = 0 then
with worksheets("sheet2").range("b2:d2").Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
end with

end if

if sheets are in different workbooks add worbooks("name"). befo
worksheets("sheet?")

eg

workbooks("name").worksheets("Sheet1").range("a1

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


Tom Ogilvy

Cell Formating
 
I think you mean:

If worksheets("Sheet1").range("a1").value = 0 then
with worksheets("sheet2").range("b2:d2").Interior
.ColorIndex = 3
.Pattern = xlSolid
. PatternColorIndex = xlAutomatic
end with

end if


--
Regards,
Tom Ogilvy

"mudraker" wrote in message
...

If worksheets("Sheet1").range("a1").value = 0 then
with worksheets("sheet2").range("b2:d2").Interior
ColorIndex = 3
Pattern = xlSolid
PatternColorIndex = xlAutomatic
end with

end if

if sheets are in different workbooks add worbooks("name"). befor
worksheets("sheet?")

eg

workbooks("name").worksheets("Sheet1").range("a1"


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 05:22 PM.

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