LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default Find Method Not Working Right ?

Ok here is the situation I am having.
I have a worksheet named Sheet1 which column "A" has a bunch of dates
starting Jan 1, 2000 and going down. Column "C" Also has a bunch of dates
starting with Jan 1, 2000 and going down. Column "D" and "E" have just
regular numerical data. Column "A" is based on 5 day week and colunm "C" is
based on 7 day week. and Row 1 is column hedders. What My codde should do
when run is highlight all the dates in column "C" that match the dates in
Column "A" and the adjacent columns which contain regular numerical data.
My Dates in column "A" run from Jan 1, 2000 to Feb 29, 2000 (5 day weekday
series)
My Dates in Column "C" run from Jan 1, 2000 to Mar 20, 2002 (7 day series)

When my code is run it misses highlighting cell "C2" which should be a
matching date with cell "A2" also in colun "C" Nov 11, 2000 is highlighted as
a matching date but doesn't exist in column "A". ..... Anyhow here is my
code.

Sub Test()
Dim BaseDateRng As Range
Dim SecondDateRng As Range
Dim cel As Range
Dim c As Range
Dim bDate As Date
Dim d As Long

Set BaseDateRng = Worksheets("Sheet1").Range("a2:a44")
'Range(frm1.RefBaseDate)

Set SecondDateRng = Worksheets("Sheet1").Range("c2:e811")
'Range(frm1.RefSecondDate)

For Each cel In BaseDateRng
bDate = cel.Value
With SecondDateRng.Columns(1)
Set c = .Find(bDate, LookIn:=xlFormulas)
d = c.Row - 1
If Not c Is Nothing Then
With SecondDateRng
.Rows(d).Interior.ColorIndex = 4
End With
End If
End With
Next cel
End Sub
 
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
Worksheet_Change method not working in Excel 97 Manoj Kumar Sharma Excel Programming 4 October 6th 04 10:38 AM
.Find method not working??? MDW Excel Programming 0 September 30th 04 01:23 PM
Find method benb Excel Programming 0 September 22nd 04 10:17 PM
Find method Kirk Excel Programming 0 September 22nd 04 09:33 PM
export method not working properly Malone[_2_] Excel Programming 2 December 24th 03 08:34 PM


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