Macro Search and display [Closed]

Report
-
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
-
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
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
800
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

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!