Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default If *Total* make row white

Hi Ryan

This works fine on my machine. It turns the rows in Column E back to
the normal uncoloured state. If you want it to be white like a ghost
try something like this.

Take care

Marcus

Option Explicit
Option Compare Text

Sub TotalColour()
Dim lastrow As Long, j As Long
lastrow = Cells(Rows.Count, 5).End(xlUp).Row
For j = lastrow To 1 Step -1
If (Cells(j, 5).Value) Like "*Total*" Then
Rows(j).Interior.ColorIndex = 2
End If
Next

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default If *Total* make row white

Instead of looking at the .value, look at the .text:

If LCase(.Cells(j, 5).Text) Like LCase("*Total*") Then

Or check for an error first:

if iserror(.cells(j,5).value) then
'skip it
else
If LCase(.Cells(j, 5).Value) Like LCase("*Total*") Then
'do the work
...
end if
end if




ryguy7272 wrote:

Well, I just found the culprit; I have this in two cells (one of each):
#VALUE!
#VALUE! Total

How can I compensate for this?

Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

"marcus" wrote:

Hi Ryan

This works fine on my machine. It turns the rows in Column E back to
the normal uncoloured state. If you want it to be white like a ghost
try something like this.

Take care

Marcus

Option Explicit
Option Compare Text

Sub TotalColour()
Dim lastrow As Long, j As Long
lastrow = Cells(Rows.Count, 5).End(xlUp).Row
For j = lastrow To 1 Step -1
If (Cells(j, 5).Value) Like "*Total*" Then
Rows(j).Interior.ColorIndex = 2
End If
Next

End Sub
.


--

Dave Peterson
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
If *Total* make row white J_Knowles[_2_] Excel Programming 0 December 11th 09 01:00 AM
Make row white unless the value of a certain cell is 0 Josh Excel Discussion (Misc queries) 6 August 11th 09 03:43 PM
How do I make a total sheet? Tia Charts and Charting in Excel 1 September 13th 07 10:31 PM
EXCEL workbook is off-white, goes white in edit mode Joe Excel Discussion (Misc queries) 0 July 15th 06 12:45 PM
Excel:I have15 #'s that total $65,000...which #'s make up $44,000 Kelly Excel Worksheet Functions 1 March 23rd 06 02:16 PM


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