Macros : How to add multiple cells into one depending on another cell & delete empty cells after

brodyb1

New Member
Joined
Feb 9, 2018
Messages
12
Hello,

I'm trying to figure out in Macros how to add the multiple cells under description (M:M) into one cell, so its one continuous descriptions . The one cell with the full description needs to be on the same row with "item" under (A:A). So basically row 3 would have the the information on row 3, whereas now under the "Description" column, the description is broken up into two cells. Then after all the information has been consolidated into one row I want to delete the empty rows between each "Item" (A:A). In the end each row with "item" has all the information, and there are no empty spaces between the rows.
yOR9Z3R.jpg%20via%20Imgur%20for%20iOS


Sorry if I'm running in circles I've been trying to describe my problem/goal accurately. I'm also new to Macros but I've done some successful codes in the past few month but this seems far out of my reach and I was hoping someone here could help me.

I ideally want it to look like this (below). Which is did with filters and filtered out the blanks, but with filters it cuts my descriptions short, which is the problem.

https://imgur.com/acpRlfY
acpRlfY

acpRlfY
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi & welcome to the board.
How about
Code:
Sub ConsolidateDelete2()

   Dim Rng As Range
   
   With Columns(1).SpecialCells(xlBlanks)
      For Each Rng In .Areas
         Rng.Offset(-1, 12).Resize(1, 1).Value = Join(Application.Transpose(Rng.Offset(-1, 12).Resize(Rng.Count + 1).Value), ", ")
      Next Rng
      .EntireRow.Delete
   End With
   
End Sub
 
Upvote 0
In that case your "Empty" cells in col A aren't empty.
How is the data being entered?
 
Upvote 0
The data is from a program called CostPoint and I just use the export as excel function. The cells seem empty when I click on the empty cells in col A. Is their a way I can send you the file?
 
Upvote 0
You can upload the file to OneDrive, dropbox, mark it for sharing & then post the link to this thread.
 
Upvote 0
This might work, depending on your data
Code:
Sub ConsolidateDelete2()

   Dim Rng As Range
   
   With Range("A2", Range("B" & Rows.Count).Offset(, -1))
      .Replace "Item", "=Item", , , False, , False, False
      For Each Rng In .SpecialCells(xlConstants).Areas
         Rng.Offset(-1, 12).Resize(1, 1).Value = Join(Application.Transpose(Rng.Offset(-1, 12).Resize(Rng.Count + 1).Value), ", ")
      Next Rng
      .SpecialCells(xlConstants).EntireRow.Delete
      .Replace "=Item", "Item", , , False, , False, False
   End With
   
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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