Hello
i have column "A" each cell in it contains value, i want to look for each value in all sheets in the workbook, when find the matching value, then copy all what's in the left of that cell from the found sheet to the master sheet taking in consideration the bellow points :
Found sheet the range order i want to copy is : E-D-C-B-A (From found cell going left until the beginning of row)
Master Sheet the copied range i want past in this order : A-B-C-D-E (A will be in column "A" the rest will be pasted to the right and go on
i tried with this peace of code but i keep getting errors .
this code does have loop command yet and still struggling with copy all to the left .
i have column "A" each cell in it contains value, i want to look for each value in all sheets in the workbook, when find the matching value, then copy all what's in the left of that cell from the found sheet to the master sheet taking in consideration the bellow points :
Found sheet the range order i want to copy is : E-D-C-B-A (From found cell going left until the beginning of row)
Master Sheet the copied range i want past in this order : A-B-C-D-E (A will be in column "A" the rest will be pasted to the right and go on
i tried with this peace of code but i keep getting errors .
this code does have loop command yet and still struggling with copy all to the left .
VBA Code:
Sub Plan_Rout()
Dim Fnd As Range, A1 As Range
Dim Lr As Long
With Sheets("sheet1")
For Each A1 In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
Set Fnd = Sheets("Sheet2").Range("A1:Z50").Find(A1.Value, , xlFormulas, xlWhole, xlByRows, xlPrevious, False, , False)
If Not Fnd Is Nothing Then A1.Offset(, 1).Value = Fnd.Offset(, -1).Value
If Not Fnd Is Nothing Then A1.Offset(, 2).Value = Fnd.Offset(, -2).Value
'if i add another with offset 3 i get error'
Next A1
End With
End Sub