Moving cells and creating columns according to a criteria in another cell

lucas_delarge

New Member
Joined
Feb 4, 2019
Messages
2
Hi friends, :biggrin:

I have to create a macro (or a formula) to do the following:

I need to get the supplier name when it appears on the below cell and transport to the same cell of the part number, adding new columns for them.

Column A --> is a structure index (not really important here)
Column B --> when I have "Supplied By Supplier (A>Sup)" I need to collect the same line value on "C" and "D" and move it to a column "E" and "F", but one line above to keep it in the same line of the father.

This is the previous table:

ABCD
3Uses Articles100000747---
3Uses Articles100000748---
3Uses Articles100120786---
4Supplied By Supplier315708909,LoctiteLoctite 5699
3Uses Articles3EER300000-2688---
4Supplied By Supplier516867611,Loctite7063 Cleaner

<tbody>
</tbody>

[HR][/HR]
Should be like this:

ABCDEF
3Uses Articles100000747---
3Uses Articles100000748---
3Uses Articles100120786---315708909,LoctiteLoctite 5699
4Supplied By Supplier
3Uses Articles3EER300000-2688---516867611,Loctite7063 Cleaner
4Supplied By Supplier

<tbody>
</tbody>

I've tried a many combinations but it didn't work. If anyone knows how to solve this. :confused:

Thanks a lot!!!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,332
Office Version
365
Platform
Windows
Hi & welcome to MrExcel
How about
Code:
Sub lucas_delarge()
   Dim Cl As Range
   
   With Range("B:B")
      .Replace "Supplied By Supplier", "#N/A", xlWhole, , False, , False, False
      For Each Cl In .SpecialCells(xlConstants, xlErrors).Areas
         Cl.Offset(, 1).Resize(, 2).Cut Cl.Offset(-1, 3)
      Next Cl
      .Replace "#N/A", "Supplied By Supplier", xlWhole, , False, , False, False
   End With
End Sub
 

Fluff

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

Forum statistics

Threads
1,082,344
Messages
5,364,806
Members
400,814
Latest member
gangstar67

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top