Right, basicly im trying to search for a cell in another xls document, and copy the name of the sheet on which it is located idealy, although at the moment it just copies the contents of A1, which will do. im getting error 91 around the search bit of the code. any ideas? i know its messy btw im not very good at this kinda thing.
FYI the first loops runs perfectly - then its errors.
pelase help asap!
FYI the first loops runs perfectly - then its errors.
pelase help asap!
Code:
Sub Macro1()
Dim n As Integer
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim e As String
For n = 3 To 811 Step 1
Windows("11.xls").Activate
Sheets("Sheet4").Select
a = "D" & n
Range(a).Select
b = ActiveCell.FormulaR1C1
Windows("ESPRESSO SPARES 2006.xls").Activate
Cells.Find(What:=b, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
Range("A1,A2").Select
c = ActiveCell.FormulaR1C1
Windows("11.xls").Activate
d = "E" & n
Range(d).Select
ActiveCell.FormulaR1C1 = c
Next n
End Sub
Last edited: