I have 2 worksheets "Cost" (name never changes) and "Option1" (names changes regularly)
I am using this code that works really well but I need it to change to a define name range
"d1:D5000" Named range = "Part_No"
I need it to loop through my "Cost" sheet Column "B30:B78" and place the Part_No that has a Qty amount which is Named range = "Qty" which is in Column G1:G5000".
Then loop through again and put the Qty amount in Column "D30:D78"
__________________________________________________________________
I am using this code that works really well but I need it to change to a define name range
"d1:D5000" Named range = "Part_No"
I need it to loop through my "Cost" sheet Column "B30:B78" and place the Part_No that has a Qty amount which is Named range = "Qty" which is in Column G1:G5000".
Then loop through again and put the Qty amount in Column "D30:D78"
Code:
LR = Sheets(SheetName).Range("G" & Rows.Count).End(xlUp).Row
MyCol = 2
MyRow = 30
For i = 1 To 5000
If Val(Sheets(SheetName).Range("G" & i).Value) > 1 Then
Do Until Sheets("Cost").Cells(MyRow, MyCol).Value = "" Or MyRow > 78
MyRow = MyRow + 1
Loop
If MyRow <= 78 Then
Sheets("Cost").Cells(MyRow, MyCol).Value = Sheets(SheetName).Range("G" & i).Value
MyRow = MyRow + 1
Else
MsgBox "You have ran out of room. Some entries were not copied"
Exit For
End If
End If
Next i
Mod edit : thread moved to appropriate forum !