Ive got a long list of data I had help with a tech running some VBA code for me and our data has changed a little and the code has broken.
Basically my data changed from 515 to 515E or 515J and I am not sure where to repair this part of the code for it to function properly. This code sorts the data to different work sheets. I did introduce a new worksheet where I want the 515E data and 515J data to get sorted to. Let me know where the breakdown may be. The debugger highlights the 3rd row of code.
Lrow = .Cells(Rows.Count, "A").End(xlUp).Row
For Each mycell In .Range("A2:A" & Lrow)
mycell.Offset(0, 1).Formula = "=IFERROR(VLOOKUP(" & mycell.Value & ",Setup!A:C,3,0),Setup!C4)"
Next mycell
.Range("B2:B" & Lrow).Copy
.Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Lrow = .Cells(Rows.Count, "B").End(xlUp).Row
For Each cell In .Range("A2:A" & Lrow)
My_Range.Parent.Select
'Filter the range
My_Range.AutoFilter Field:=FieldNum, Criteria1:="=" & _
Replace(Replace(Replace(cell.Value, "~", "~~"), "*", "~*"), "?", "~?")
Basically my data changed from 515 to 515E or 515J and I am not sure where to repair this part of the code for it to function properly. This code sorts the data to different work sheets. I did introduce a new worksheet where I want the 515E data and 515J data to get sorted to. Let me know where the breakdown may be. The debugger highlights the 3rd row of code.
Lrow = .Cells(Rows.Count, "A").End(xlUp).Row
For Each mycell In .Range("A2:A" & Lrow)
mycell.Offset(0, 1).Formula = "=IFERROR(VLOOKUP(" & mycell.Value & ",Setup!A:C,3,0),Setup!C4)"
Next mycell
.Range("B2:B" & Lrow).Copy
.Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Lrow = .Cells(Rows.Count, "B").End(xlUp).Row
For Each cell In .Range("A2:A" & Lrow)
My_Range.Parent.Select
'Filter the range
My_Range.AutoFilter Field:=FieldNum, Criteria1:="=" & _
Replace(Replace(Replace(cell.Value, "~", "~~"), "*", "~*"), "?", "~?")