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/:i:/g/personal/samson_a_wehi_edu_au/EXlZ8b6oFZ9KolBTe8muMpsBVkH6hgGTxS7dzr25zOXXdA?e=sDq7HR

Linked image #2 : https://wehieduau-my.sharepoint.com/:i:/g/personal/samson_a_wehi_edu_au/EZuL6yYKvY1CjfUZAPkxDoIBkRJjTprd6__kX2Zxiw6eGQ?e=KBkAJu

Any help with this would be greatly appreciated.

Thanks,

Andre
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,880
Office Version
365
Platform
Windows
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
 

Samson_ALS

New Member
Joined
Sep 26, 2019
Messages
2
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!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,880
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Forum statistics

Threads
1,085,882
Messages
5,386,536
Members
402,004
Latest member
moneyman4438

Some videos you may like

This Week's Hot Topics

Top