Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default macro that counts lines with certain color

hi all i need a macro that counts the lines with ColorIndex = 3 and gives it
out in a msg box. It should do the same for colorindex 4 and 5.

Thx alot in advance


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default macro that counts lines with certain color

Mine doesnt work but i dont know why

Sub StatistikAusgeben()
Const Stat1 = "Open Tickets"
Dim i As Integer
Dim iAnz As Integer
Sheets(Stat1).Activate
Range("A1").Select

iAnz = 0
i = 0

Do Until i = ActiveSheet.UsedRange.Rows.Count
If Selection.Interior.Color = RGB(128, 255, 196) Then
iAnz = iAnz + 1
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
End If
i = i + 1
Loop

MsgBox "Es wurden " & iAnz & " kritische Tickets gefunden"
End Sub


Thx alot


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro that counts lines with certain color

using color is probably the source of your problem. Excel only used 56
colors for cells, so good chance your color is not one of them. Better to
use colorindex

Sub StatistikAusgeben()
Const Stat1 = "Open Tickets"
Dim i As Integer
Dim iAnz As Integer
Sheets(Stat1).Activate
Range("A1").Select

iAnz = 0
i = 0

Do Until i = ActiveSheet.UsedRange.Rows.Count
If Selection.Interior.ColorIndex = 3 Then
iAnz = iAnz + 1
End If
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop

MsgBox "Es wurden " & iAnz & " kritische Tickets gefunden"
End Sub


--
Regards,
Tom Ogilvy

"Philipp Oberleitner" wrote in message
...
Mine doesnt work but i dont know why

Sub StatistikAusgeben()
Const Stat1 = "Open Tickets"
Dim i As Integer
Dim iAnz As Integer
Sheets(Stat1).Activate
Range("A1").Select

iAnz = 0
i = 0

Do Until i = ActiveSheet.UsedRange.Rows.Count
If Selection.Interior.Color = RGB(128, 255, 196) Then
iAnz = iAnz + 1
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
End If
i = i + 1
Loop

MsgBox "Es wurden " & iAnz & " kritische Tickets gefunden"
End Sub


Thx alot




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
average daily counts to weekly counts Dave Excel Discussion (Misc queries) 0 June 17th 08 06:24 PM
How does a macro total columns when sheets have diff row counts? Chuck@qgold Excel Discussion (Misc queries) 1 April 20th 07 04:24 PM
Macro that counts the Nbr of Teams and calculate the total & Ratio Jurassien Excel Discussion (Misc queries) 0 March 6th 07 05:20 PM
A macro that counts the number of times a file is opened [email protected] Excel Discussion (Misc queries) 2 December 20th 06 01:53 PM
macro for fixed color lines in line chart based on series name sm Charts and Charting in Excel 1 November 13th 06 09:31 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"