Color cells if

  • Thread starter Thread starter Ymtrader
  • Start date Start date
Y

Ymtrader

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.
 
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!
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top