Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default select and nonselect ??

There are merged cells in [A1:D10].
see the below "c.select" is commented.
by the way, the result is not using "c.select" is not commented.
the answer is not commented.
why????

Sub cnt_blu_red_in_dde()

Call sb_cnt_blue_red(Sheets("DDE").[A1:D10])
[F11].Value = blue_cnt
[H11].Value = red_cnt

End Sub


Sub sb_cnt_blue_red(rng As Range)
Dim fcs As FormatConditions
Dim c As Range
Dim adr As String

For Each c In rng
' c.Select
Set fcs = c.FormatConditions
If fcs.Count 0 Then
If c.MergeCells = True Then
adr = c.Address
For Each c_fir In c.MergeArea
Exit For
Next
If c_fir.Address < adr Then
GoTo ee:
End If
End If



For i = 1 To fcs.Count
If fcs(i).Type = 1 Then
If fcs(i).Operator = xlEqual Then
If c.Value = Application.Evaluate(fcs(i).Formula1) Then
GoTo zz
End If
ElseIf fcs(i).Operator = xlGreater Then
If c.Value Application.Evaluate(fcs(i).Formula1) Then
GoTo zz
End If
ElseIf fcs(i).Operator = xlGreaterEqual Then
If c.Value = Application.Evaluate(fcs(i).Formula1) Then
GoTo zz
End If

ElseIf fcs(i).Operator = xlLess Then
If c.Value < Application.Evaluate(fcs(i).Formula1) Then
GoTo zz
End If
ElseIf fcs(i).Operator = xlLessEqual Then
If c.Value <= Application.Evaluate(fcs(i).Formula1) Then
GoTo zz
End If


ElseIf fcs(i).Operator = xlBetween Then
If c.Value = Application.Evaluate(fcs(i).Formula1) And
c.Value <= Application.Evaluate(fcs(i).Formula2) Then
GoTo zz
End If
ElseIf fcs(i).Operator = xlNotBetween Then
If c.Value < Application.Evaluate(fcs(i).Formula1) And
c.Value Application.Evaluate(fcs(i).Formula2) Then
GoTo zz
End If
ElseIf fcs(i).Operator = xlNotEqual Then
If c.Value < Application.Evaluate(fcs(i).Formula1) Then
GoTo zz
End If


End If
ElseIf fcs(i).Type = 2 Then
On Error GoTo xx
If Application.Evaluate(fcs(i).Formula1) = True Then
GoTo zz
End If
End If

Next
End If
ee:
Next
Exit Sub

xx:
Resume ee

zz:
If fcs(i).Interior.ColorIndex = BLUE Then
blue_cnt = blue_cnt + 1
ElseIf fcs(i).Interior.ColorIndex = RED Then
red_cnt = red_cnt + 1
End If
GoTo ee

End Sub



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
VBA: Column Select then Data Select then return to cell A1 James C[_2_] Excel Discussion (Misc queries) 3 February 1st 10 11:35 AM
Macro to select cells without a certain value and select a menu it Guy[_2_] Excel Worksheet Functions 9 January 2nd 09 05:21 PM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 5th 05 12:03 AM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 4th 05 11:59 PM
Select other workbook to select data in a macro. T Tromp Excel Programming 2 September 19th 03 01:43 PM


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