Hello all,
I have two workbooks. "Copy" is where I am organizing all of my data. "2014 Metric Summary Report" is a system output... and it's a mess. My goal is to have the macro find the asset (Listed in column A in both workbooks, but not the same order) and copy data from one workbook to the next for each asset.
The debugger stops me at: Txt = Workbooks("WB1").Sheets("33300.20.5392877").Cell(i, 1).Value saying 'Subscript out of range.' Here is where I need the macro to somehow take the text in the cell and find that text in the second workbook.
Sub Macro2()
Dim i As Long
Dim Txt$, MyPath$, WB1$, WB2$
Application.ScreenUpdating = False
MyPath = "C:\"
WB1 = "Copy.xlsm"
WB2 = "2014 Metric Summary Report.xlsm"
Workbooks.Open Filename:=MyPath & WB2
For i = 3 To 31
Txt = Workbooks("WB1").Sheets("33300.20.5392877").Cell(i, 1).Value
Workbooks("WB2").Range("A11:A30").Find(Txt, searchorder:=xlByColumns).Activate
ActiveCell.Offset(0, 6).Copy
Workbooks("WB1").Sheets("Live").Cell(i, 20).Paste
Application.CutCopyMode = False
Next i
End Sub
Any thoughts? Thanks for your time!
P.S. Also, how could I qualify the code so that if the text is not found, it just goes onto the next i?
Bookmarks