LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Matching Value placed in next column

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
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
Matching down a column Tsunami3169 Excel Worksheet Functions 3 August 1st 07 02:47 PM
column matching danm5644 Excel Discussion (Misc queries) 1 March 1st 07 09:48 PM
matching from one column to another JMay Excel Discussion (Misc queries) 0 November 29th 06 08:49 PM
matching from one column to another jbressma Excel Discussion (Misc queries) 0 November 29th 06 08:04 PM
Matching cell in one column to value in another Bruce Excel Programming 2 June 7th 04 03:24 PM


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