VBA Question

Eb0la11

Board Regular
Joined
Apr 2, 2007
Messages
56
Office Version
  1. 365
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, "~", "~~"), "*", "~*"), "?", "~?")
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Bump. The VBA code looks at a few columns, the column which had the data change is the third one. This is where the 515 to 515E or 515J change occurs.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top