find a particular date in another sheet

macangc

Board Regular
Joined
Mar 28, 2006
Messages
140
Office Version
  1. 365
Hi there

Relative newcomer to Visual Basic and i would like some help with the following if possible

I have a cell that i will enter a date into and when i click the button below it will find the same date in another sheet, then move down one cell and across one.

Thanks in advance
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Welcome to the board!

Much of the code you need can be obtained using the macro recorder. Give this a go. Obviously, you will need to change the sheet names and range to suit your worksheet.
Code:
Sub MyFind()

'   Capture value to find from sheet 1 
    Dim myFindDate As Date
    myFindDate = Sheets("Sheet1").Range("F1")
    
'   Find value on sheet 2
    Sheets("Sheet2").Activate
    On Error GoTo err_chk
    Cells.Find(What:=myFindDate, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
        :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
        False).Offset(1, 1).Activate
    On Error GoTo 0
    
    Exit Sub
'   Error handling if it cannot find value
err_chk:
    If Err.Number = 91 Then
        Sheets("Sheet1").Activate
        MsgBox "Cannot find the value " & myFindDate
    Else
        MsgBox Err.Number & ": " & Err.Description
    End If
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,217,438
Messages
6,136,616
Members
450,022
Latest member
Joel1122331

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top