LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
jt jt is offline
external usenet poster
 
Posts: 18
Default count cells with diagonal borders

Hi,
I have some code that counts cells with specific color, now I also
want to count all cells with diagonal borders. The cell color count
VBA is below...

Function CellColorIndex(InRange As Range, Optional _
OfText As Boolean = False) As Integer
'
' This function returns the ColorIndex value of a the Interior
' (background) of a cell, or, if OfText is true, of the Font in the
cell.
'
Application.Volatile True
If OfText = True Then
CellColorIndex = InRange(1, 1).Font.ColorIndex
Else
CellColorIndex = InRange(1, 1).Interior.ColorIndex
End If


End Function


Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
'
' This function return the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex.
'
Dim Rng As Range
Application.Volatile True


For Each Rng In InRange.Cells
If OfText = True Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng


End Function


any help is appreciated as usual...thankyou.



 
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
count cells with diagonal borders jt Excel Programming 3 September 26th 11 12:55 AM
count cells with diagonal cell borders jt Excel Programming 0 May 3rd 11 03:02 PM
Diagonal Borders Rosi Excel Discussion (Misc queries) 3 October 28th 08 07:13 PM
Creating cells with Diagonal borders Graham Tritton Excel Discussion (Misc queries) 1 January 24th 06 06:09 AM
Test if cell has diagonal borders Brad Excel Programming 4 September 30th 05 01:36 PM


All times are GMT +1. The time now is 06:51 PM.

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"