LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Conditional Find

Thanks! That works nicely.
--
Steve C


"Incidental" wrote:

Hi Steve

You could try something like the code below that should give you an
idea of how to do what your after. I added this code to a user button
but it could be amended to fit what ever you like.

Option Explicit
Dim MyDate As Date 'declare your variable as a date

Private Sub CommandButton1_Click()

MyDate = InputBox("Please Enter a Date", "Date Finder") 'enter a date
to find

On Error Resume Next 'add this to trap the error on date not found

With Range("TestRng") 'set the range to search

.Find(What:=MyDate, LookAt:=xlWhole).Activate 'if found activate
the cell

If ActiveCell.Value = MyDate Then ' if active cell matches
your date do this

MsgBox "Run the code for a finding a date"

Else 'if it doesn't match then do this

MsgBox "Run the code for a date not found"

End If

End With

End Sub

Hope this helps

S




 
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
Challenge with conditional find Vic[_4_] Excel Programming 3 May 13th 07 02:40 AM
Conditional FIND and REPLACE wisynco Excel Worksheet Functions 0 June 7th 06 06:46 PM
conditional statement to find more than one value ?? gaba Excel Programming 2 October 29th 04 02:04 AM
Conditional find Ramesh[_2_] Excel Programming 1 October 28th 03 10:38 PM
Conditional find Ramesh[_2_] Excel Programming 1 October 22nd 03 03:47 PM


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