VBA for Pallet Exploder

VapeLizard420

New Member
Joined
Jul 16, 2018
Messages
2
Hello All,

I am looking to create a macro that runs through a list of part numbers. Some of these part numbers are pallets that contain certain end items. I need to write a macro that identifies these pallets, and creates separate line items for each component of the pallet, then deletes the original pallet line so it is not counted twice.

I do not have the spreadsheet specifics at this time, but could anyone help me with a general approach to this? If you could just give me a list of things to look up how to do, that might be helpful.

Thanks all,

VapeLizard
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
VapeLizard420,

Welcome to the Board.

Generally, one approach would be to...

Define the range that contains the list of part numbers
Create a Loop through the range
Use an If statement to determine if the part number includes your end item criteria
If so, Insert blank rows to accommodate the new components
Add the new component data
Delete the original row

For example...

Code:
Sub SampleCode()
Dim LastRow As Long, i As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row

For i = LastRow To 2 Step -1
    If InStr(Cells(r, 1).Value, "identifier") > 0 Then
        Rows(r.Row + 1 & ":" & r.Row + 3).Insert
        'code to add pallet components
        Rows(r.Row).Delete
    End If
Next i
End Sub

Cheers,

tonyyy
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,181
Members
449,071
Latest member
cdnMech

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