LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default PLEASE help

Tom raises a good point about what to do with the result, which I did not
focus on AND subsequently left out. Here's something that might work better
if you want to act on the results separately from the test:

'Use the following sub to process your task.
'It calls the bCheckMyCells() function (modified version included here).

Sub CheckMyCells()
Dim r As Long, lNumRows As Long, lStartRow As Long

lStartRow = 2
lNumRows = lStartRow + 199

For r = lStartRow To lNumRows
If Cells(r, "F") < "" Then
If bCheckMyCells(r) Then
'do some OK thing
Else
'do some NOT OK thing
End If
End If
Next r
End Sub


'This is a revised version of my original concept using Cells()
' (borrowed from Tom's suggestion).
Function bCheckMyCells(ByVal Row As Long) As Boolean
Select Case ActiveSheet.Range("F" & Row).Value
Case Is = 10 And _
Cells(Row, "G") = Cells(Row, "D"): bCheckMyCells = True
Case Is = Cells(Row, "D") And _
Cells(Row, "G") <= Cells(Row, "D"): bCheckMyCells = False
Case Is < 10 And _
Cells(Row + 1, "E") = Cells(Row + 1, "D"): bCheckMyCells = True
Case Is < 10 And _
Cells(Row + 1, "E") < Cells(Row + 1, "D"): bCheckMyCells = False
End Select
End Function

Regards,
Garry


 
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



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