VBA Complex Organizational Loop

ZCapitao

New Member
Joined
Dec 3, 2024
Messages
1
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi all :)

This is to be a monthly task so it needs to be a VBA instead of manually editing the data.
I have data (about 82K rows) that has been extracted from a PDF, the problem is some of the pages have copied the tables into different ranges. For example while pg. X copied into range A:M, pg. Y copied into range C:T.
There are many rows which can be stripped out. But we need to keep the rows without part numbers but do have quantities and values.
I need to keep the rows in the same order because some part numbers were not pulled and will need to be filled in manually later.
Basically what I want is this:

Part_Number, Part_Number_Suffix, Part_Description, Location, Keyword, Product_Category, Min, Max, Quantity_OnHand, Quantity_OnOrder, Value_OnHand,Value_OnOrder

Parts come with three pieces of information in one cell which need to be split out. Part_Number, Part_Suffix, and Part_Description
Part Numbers come with differing suffix values for example Part 6354443 comes in "635443-0 - *" and "635443-97 -*" that need to be stripped out

My first thought is to
For Loop i = Lastrow To 1 Step -1,
Concatenate Ai:Ti and place the value in cell Ai. 'This fixes the tables with differing ranges issue
If Ai contains "Location" Or "Total:" or is blank, delete the entire row
Next i

I would then need to split them all out again and I cannot seem to get that to work.
Any help would be appreciated.
 

Attachments

  • Screenshot 2024-12-03 124751.png
    Screenshot 2024-12-03 124751.png
    58.7 KB · Views: 8

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi all :)

This is to be a monthly task so it needs to be a VBA instead of manually editing the data.
I have data (about 82K rows) that has been extracted from a PDF, the problem is some of the pages have copied the tables into different ranges. For example while pg. X copied into range A:M, pg. Y copied into range C:T.
There are many rows which can be stripped out. But we need to keep the rows without part numbers but do have quantities and values.
I need to keep the rows in the same order because some part numbers were not pulled and will need to be filled in manually later.
Basically what I want is this:

Part_Number, Part_Number_Suffix, Part_Description, Location, Keyword, Product_Category, Min, Max, Quantity_OnHand, Quantity_OnOrder, Value_OnHand,Value_OnOrder

Parts come with three pieces of information in one cell which need to be split out. Part_Number, Part_Suffix, and Part_Description
Part Numbers come with differing suffix values for example Part 6354443 comes in "635443-0 - *" and "635443-97 -*" that need to be stripped out

My first thought is to
For Loop i = Lastrow To 1 Step -1,
Concatenate Ai:Ti and place the value in cell Ai. 'This fixes the tables with differing ranges issue
If Ai contains "Location" Or "Total:" or is blank, delete the entire row
Next i

I would then need to split them all out again and I cannot seem to get that to work.
Any help would be appreciated.
Are you able to use XL2BB to post a reasonable amount of data and maybe highlight the different blocks of data that need to be rearranged?
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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