ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Color cells if (https://www.excelbanter.com/excel-programming/413286-color-cells-if.html)

Ymtrader

Color cells if
 
I have a spreadsheet in which daily data was imported. At the end of each day
I need to color 1 row 7 columns wide (as if to make a line that inlcudes the
totals), these colored cells contain totals for the day. How might I
automate this. It takes so long to go through by hand. Any ideas
appreciated. Thanks.

RyanH

Color cells if
 
Yes that is possible to do. I'm not sure where your "Totals", thus I can't
write code to find them. So I will have to make some assumptions. Assuming
you have the word "Totals" in Col. A and the actual totals range is next to
"Totals", this should work for you. I highlighted the Font Red.

Sub ColorTotals()

Dim myTotalRow As Long

myTotalRow = Sheets("Sheet1").Range("A:A").Find("Totals").Row

Sheets("Sheet1").Range(Cells(myTotalRow, 2), Cells(myTotalRow,
8)).Font.Color = vbRed

End Sub

Hope this helps!
--
Cheers,
Ryan


"Ymtrader" wrote:

I have a spreadsheet in which daily data was imported. At the end of each day
I need to color 1 row 7 columns wide (as if to make a line that inlcudes the
totals), these colored cells contain totals for the day. How might I
automate this. It takes so long to go through by hand. Any ideas
appreciated. Thanks.


Don Guillett

Color cells if
 
Look in the vba help index for FINDNEXT.There is a good example to color all
rows with your find
Then modify to search for "Total"

c.resize(0,7).interior.colorindex=6

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ymtrader" wrote in message
...
I have a spreadsheet in which daily data was imported. At the end of each
day
I need to color 1 row 7 columns wide (as if to make a line that inlcudes
the
totals), these colored cells contain totals for the day. How might I
automate this. It takes so long to go through by hand. Any ideas
appreciated. Thanks.




All times are GMT +1. The time now is 03:30 AM.

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