Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
First, this is a plain text newsgroup. Most regulars don't like attachments or
HTML posts. But Now is pretty fine time. You have to match date, time (done to the second???). And if you want to match the complete date (no matter how it's formatted in the cell), you could use something like: Option Explicit Sub testme01() Dim res As Variant res = Application.Match(CLng(Date), Range("b17:b28"), 0) If IsError(res) Then MsgBox "no match" Else MsgBox "match on row: " & res + Range("b17").Row - 1 End If End Sub But if you don't know the days that are in B17:B28, I'd just loop through them. Option Explicit Sub testme01() Dim FoundAMatch As Boolean Dim myRng As Range Dim myCell As Range Set myRng = ActiveSheet.Range("b17:b28") FoundAMatch = False For Each myCell In myRng.Cells If Format(myCell, "mmmm yy") = Format(Date, "mmmm yy") Then FoundAMatch = True Exit For End If Next myCell If FoundAMatch Then MsgBox "match on row: " & myCell.Row Else MsgBox "no match" End If End Sub Corey wrote: I am still to work out an effective solution to this: I have a list of dates in a (mmmm yy) format in Sheet1 Range(B17:B28) At the end of a macro in another sheet I want to place Now() in a (mmmm yy) format in the Cell NEXT to the MATCHING Value in Column C. I have yet to workout how to MATCH the values so the MATCHING mmmm yy is placed NEXT to the mmmm yy in Column B. I need to code this as say: If Now() = Sheet1.Range(B17:B28).Cells.Value then Sheet1.Range(B17:B28).Cells.Activate ActiveCell.Offset(0,1).value = Now() end sub How can I code this logically to actually work? Corey.... -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Matching down a column | Excel Worksheet Functions | |||
column matching | Excel Discussion (Misc queries) | |||
matching from one column to another | Excel Discussion (Misc queries) | |||
matching from one column to another | Excel Discussion (Misc queries) | |||
Matching cell in one column to value in another | Excel Programming |