Hi!
I am very VERY new to VBA macros. After spending a few days trying to put together logic by looking at different websites and codes, I finally thought I had something that would work.... however, I went to run the code and I received a run time error I cannot figure this one out... please help! here is my code:
Sub CDW()
Dim wb As Worksheet: Set wb = ActiveWorkbook.Sheets("Routing Guide Overview")
Dim wb2 As Worksheet: Set wb2 = ActiveWorkbook.Sheets("PRINTABLE Routing Guide")
Dim ToFind As String
Dim i, x As Long
Dim Ary1 As Range
Dim Ary2 As Range
Dim size As String
Application.ScreenUpdating = False
i = 2
x = 12
size = "20FT"
ToFind = "CDW"
Do
i = i + 1
For i = 2 To 1000:
If wb.Cells(i, 2) = ToFind And wb.Cells(i, 3) = size Then
wb.Activate
Set Ary1 = Range("Fi:Ii")
wb2.Activate
Set Ary2 = Range("Ax:Dx")
Ary2.Value = Ary1.Value
x = x + 1
End If
Next i
Loop Until Cells(i, 2).Value = ""
End Sub
Bookmarks