VBA insert new rows between rows based on criteria or cell value

Status
Not open for further replies.

Yna26

New Member
Joined
Jun 13, 2024
Messages
4
Office Version
  1. 2019
Platform
  1. Windows
Hi All, in my worksheet i have 2 types of shipment numbers tbe-0000 and tbew-0000. These shipments can have from 1 to several products i.e. rows to be copied in my worksheet (Tracking data) from another worksheet (Shipment details) and I am looking for a code to identify the last tbe number in my worksheet which is let's say tbe-6655 and copy the tbe-6656 rows right below it, then tbe-6657 rows and so on, same way to work with tbew. The only way I managed to do it so far was to create new rows at the end of the entire table and copy data which looks too chaotic as I must mention the fact that first part of my table contains tbe numbers, then towards the bottom of the table right after last tbe starts the tbew. I also mention the fact that I don't always receive them in their numerical order i.e. if my last tbe was tbe-6655 and now I received tbe-6657 first, I would like the code to still be able to identify and insert rows from tbe-6657 right below last row of tbe-6655 until I get data on tbe-6656 which would then be copied in between tbe-6655 and tbe-6657. I hope it makes sense and Appreciate any help.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Duplicate to: VBA to copy, format, drag down data from other workbooks

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread. If you do not receive a response, you can "bump" it by replying to it yourself, though we advise you to wait 24 hours before doing so, and not to bump a thread more than once a day.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

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