Move dataset to new column when descriptor appears

Samson_ALS

New Member
Joined
Sep 26, 2019
Messages
2
Hi,

I'm trying to move a dataset into a new set of columns every time a descriptor appears.

More specifically, if you look at linked images, I would like to move the corresponding dataset to new columns every time the word "particle" appears.

Linked image #1 : https://wehieduau-my.sharepoint.com...9KolBTe8muMpsBVkH6hgGTxS7dzr25zOXXdA?e=sDq7HR

Linked image #2 : https://wehieduau-my.sharepoint.com...1CjfUZAPkxDoIBkRJjTprd6__kX2Zxiw6eGQ?e=KBkAJu

Any help with this would be greatly appreciated.

Thanks,

Andre
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi & welcome to MrExcel.
How about
Code:
Sub SamsonALS()
   Dim Ar As Areas
   Dim i As Long
   
   Set Ar = Range("A:A").SpecialCells(xlConstants).Areas
   For i = 2 To Ar.Count
      Ar(i).Resize(, (i - 1) * 4).Insert xlToRight
   Next i
End Sub
 
Upvote 0
Hi & welcome to MrExcel.
How about
Code:
Sub SamsonALS()
   Dim Ar As Areas
   Dim i As Long
   
   Set Ar = Range("A:A").SpecialCells(xlConstants).Areas
   For i = 2 To Ar.Count
      Ar(i).Resize(, (i - 1) * 4).Insert xlToRight
   Next i
End Sub

Hi Fluff,

Thanks for your reply. Your code worked perfectly. Much appreciated!
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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