Macro Search and display

Closed
Report
-
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
-
Hello,

How do i search a spreadsheet to find a date equal to todays date, then copy values in column B and column C and paste in another Worksheet.

Column A contains dates from 01/08/09 to 31/08/09
Column B contains Names
Column C contains addresses

I want to have a macro/vba code assigned to a command button which enables me to do this everytime i select that command button on any day.

Example:

Today i go into the spreadsheet, press the command button and it finds todays date in column A and then copies values in Column B and C and opens up another spreadsheet and pastes them into this spreadsheet.

Hope this all makes sense!!


thanks

PM

1 reply

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
804
use this macro

Sub test()
Dim rng As Range, d As Date
Set rng = Range(Range("a1"), Range("a1").End(xlDown))
d = Date

rng.Cells.Find(what:=d, lookat:=xlWhole).Activate
Range(Cells(ActiveCell.Row, "b"), Cells(ActiveCell.Row, "c")).Copy
Worksheets("sheet2").Cells(Rows.Count, "a").End(xlUp).Offset(1, 0).PasteSpecial

End Sub
0