Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Worksheet_Change method not working in Excel 97 | Excel Programming | |||
.Find method not working??? | Excel Programming | |||
Find method | Excel Programming | |||
Find method | Excel Programming | |||
export method not working properly | Excel Programming |