LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Avoid re-entering 'Find what:'

Option Explicit
Sub Find_Date()
Dim Yday As Date
Dim rng As Range
Dim rng1 As Range
Dim rwStart As Long
Dim rwEnd As Long
Yday = Range("B1").Value
Set rng = Range(Cells(1, "A"), Cells(Rows.Count, "A").End(xlUp))
rwStart = rng.Rows(1).Row
rwEnd = rng.Rows(rng.Rows.Count).Row
For i = rwEnd To rwStart Step -1
Set rng1 = Cells(i, "A")
If Not rng1.HasFormula Then
If IsDate(rng1.Value) Then
If CDate(rng1.Value) = Yday Then
rng1.Select
End If
End If
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Mon, 19 Nov 2007 02:40:00 -0800, Gav wrote:

Col A contains a list of dates. In Cell B1 I enter a single date. How do I
write a macro to find the cell in Col A with the date which matches B1 and
make it the Active Cell. I could use Edit/Find but do not want to re-enter
the B1 date in 'Find what:'. I want the macro to use the B1 date
automatically.


 
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
How to avoid name ref in formula? [email protected] Excel Discussion (Misc queries) 3 April 17th 06 06:17 PM
How to avoid #DIV/0 from appearing Chris921 Excel Discussion (Misc queries) 1 March 1st 06 05:12 PM
Where can I find { } that I need to use for entering a constant? Jason Excel Discussion (Misc queries) 4 February 19th 06 08:19 PM
what is this, how do I avoid it? datadude1959 Excel Discussion (Misc queries) 2 September 29th 05 06:05 PM
Why does Help go to network? How to avoid it? [email protected] Excel Discussion (Misc queries) 5 March 11th 05 02:17 PM


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