So I am basically needing to different arrays to progress at the same time in the loop for it to paste values on each different sheet. I am not understanding how to get both to progress...
Sub TransAll()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Dim wb1 As Workbook, wb2 As Workbook, wb3 As Workbook
Dim Arr1 As Variant, Arr2 As Variant, Arr3 As Variant, Arr4 As Variant
Dim i As Integer
Dim x As Integer
Set wb1 = Workbooks("primecost.xlsm")
Set wb2 = Workbooks("inventory.xlsm")
Set wb3 = Workbooks("transmanager.xlsm")
Arr1 = Array(2, 3, 5, 6)
Arr2 = Array(2, 3, 4, 5, 6, 7)
Arr3 = Array(1, 2, 3, 4)
Arr4 = Array(5, 6, 7, 8, 9)
'for "I" works fine by iteself, but it needs "I" and "X" to progress accordingly in the same loop according to the different arrays.
For i = LBound(Arr1) To UBound(Arr1)
'For x = LBound(Arr3) To UBound(Arr3)
wb1.Sheets(Arr1(i)).Cells.Copy
wb3.Sheets(Arr3(x)).Cells.PasteSpecial Paste:=xlPasteValues
Next i
'Next x
'------------------------------------------------------------------
'this works but on at a time... very slow and a pain
'wb1.Sheets(6).Cells.Copy
'wb3.Sheets(1).Cells.PasteSpecial Paste:=xlPasteValues
'------------------------------------------------------------------
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.DisplayAlerts = True
End Sub
I just need to know how to get both variants progressing inside the same loop.
x = x+1after you use it?Next xto be aboveNext i