Is it possible to have a macro which finds the date in sheet1 column a compared to sheet 2 A2 and select the columns C,D & E in that row so that I can paste data?
Is it possible to have a macro which finds the date in sheet1 column a compared to sheet 2 A2 and select the columns C,D & E in that row so that I can paste data?
Maybe:
![]()
Sub Burt_100y() Dim r As Range Dim s As String Dim x As String, y As String, z As String s = Sheets("Sheet2").Range("A2").Value Sheets("Sheet1").Activate Set r = Columns(1).Find(s, LookIn:=xlValues, lookat:=xlPart) If Not r Is Nothing Then x = Cells(r.Row, "C").Address(False, False) y = Cells(r.Row, "D").Address(False, False) z = Cells(r.Row, "E").Address(False, False) End If Set r = Nothing Range(x) = "I Hope" Range(y) = "This" Range(z) = "Helps" End Sub
Last edited by JOHN H. DAVIS; 03-17-2015 at 03:08 PM.
This selects the cells C:E in the found date column. But for what it's worth, you rarely if ever need to select a range. You can just copy and paste it in the code without needing to select it.
![]()
Sub Burt_100() Set c = Worksheets("Sheet1").Range("A:A").Find(Worksheets("Sheet2").Range("A2").Value) If Not c Is Nothing Then Range("C" & c.Row & ":E" & c.Row).Select End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks