Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Im trying to colour code my Subtotal rows as part of my macro. I want to search the sheet and colour it red if its a subtotal. I tried the following but it ignored the Grand Total Row. Is there a way to say "If its a subtotal type of data colour it red"? Thanks Here is my code for the grand total that does not work. For Rowdates2 = Range("A1").End(xlDown).Row To 1 Step -2 If Cells(Rowdates2, "A").Value = "Grand Total" Then Rows(Rowdates2).Interior.ColorIndex = "5" Else End I -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
a way without VBA would be to use conditional formating: - select your column A - goto 'Format - Conditional Format' - enter the formula =ISNUMBER(FIND(A1,"Total")) - choose your format -- Regards Frank Kabel Frankfurt, Germany Hi, Im trying to colour code my Subtotal rows as part of my macro. I want to search the sheet and colour it red if its a subtotal. I tried the following but it ignored the Grand Total Row. Is there a way to say "If its a subtotal type of data colour it red"? Thanks Here is my code for the grand total that does not work. For Rowdates2 = Range("A1").End(xlDown).Row To 1 Step -2 If Cells(Rowdates2, "A").Value = "Grand Total" Then Rows(Rowdates2).Interior.ColorIndex = "5" Else End If --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
But I need it to do it in VBA!
Anyone else got any ideas? Thank -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try changing the line If Cells(Rowdates2, "A").Value = "Grand Total" Then to If InStr(Cells(Rowdates2, "A").Value,"Total") 0 Then just curious: Why do you have to do it in VBA (usually slower than using a conditional format) -- Regards Frank Kabel Frankfurt, Germany "andycharger " schrieb im Newsbeitrag ... But I need it to do it in VBA! Anyone else got any ideas? Thanks --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Subtotal To Include Item Description On Subtotal Line | Excel Discussion (Misc queries) | |||
sort macro, subtotal and add lines after subtotal | Excel Discussion (Misc queries) | |||
pasting to subtotal lines without replacing hidden -non-subtotal l | Excel Discussion (Misc queries) | |||
Bolding the subtotal lines automaticlly When using the Subtotal fu | New Users to Excel | |||
Subtotal of Subtotal displays Grand Total in wrong row | Excel Worksheet Functions |