instanceoftime
Board Regular
- Joined
- Mar 23, 2011
- Messages
- 102
I am looking at each cell in column D sheet1 and finding the matching number on sheet2 column A and copying B,C,D of sheet2 back to sheet1 A,B,C
the following works to a degree. the name is being put in E,F,G instead of A,B,C and after completing the first "round" (get's one person)I get an error 91 "Object variable or With block variable not set". (and is slow...) any better ideas or help?
Sub FillIn()
Dim c As Range, a As Range
For Each c In Range("D2:D" & Cells(Rows.Count, "D").End(xlUp).Row)
With Sheets("Sheet2").Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row)
Set a = .Find(c.Value, LookIn:=xlValues)
End With
c.Offset(, 1).Resize(, 3).Value = a.Offset(, 1).Resize(, 3).Value
Next c
End Sub
thanks
the following works to a degree. the name is being put in E,F,G instead of A,B,C and after completing the first "round" (get's one person)I get an error 91 "Object variable or With block variable not set". (and is slow...) any better ideas or help?
Sub FillIn()
Dim c As Range, a As Range
For Each c In Range("D2:D" & Cells(Rows.Count, "D").End(xlUp).Row)
With Sheets("Sheet2").Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row)
Set a = .Find(c.Value, LookIn:=xlValues)
End With
c.Offset(, 1).Resize(, 3).Value = a.Offset(, 1).Resize(, 3).Value
Next c
End Sub
thanks