Creating a new sheet with data that is merged to one cell per row

coretex99

New Member
Joined
Feb 25, 2020
Messages
17
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I've been struggling with what I thought would be a basic Macro, would appreciate some guidance if possible.

Our CRM spits out an excel sheet of hundreds of rows similar to the one below.

Unique Item NumberItemItem DescriptionCodeQuantityUnitsValueCurrencyWeightWeight 2CountryReference TypeDetailsVAT
12345​
GG666Test Item5555
1​
EA
99.99​
GBP
5​
KR


I need to create a Macro on a separate "template" sheet that can take all the data per row and create a new sheet with it all merge in the first row, and subsequent rows, delaminated with a comma.

12345,Test Item ,GG666 ,1,EA,99.99,GBP,5,,KR,,,,

I have tried recording a Macro but not getting very far. Any help would be appreciated :) Thanks
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
VBA Code:
Sub copyData()
  Sheets.Add.Name = "template"
  Dim lRow As Integer
    lRow = Worksheets("CRM").Cells(Rows.Count, 1).End(xlUp).Row
    For i = 1 To lRow
          With Worksheets("CRM")
               Worksheets("template").Cells(i, 1).Value = .Cells(i,1).Value&","&.Cells(i,3).Value&","&.Cells(i,2).Value&","&.Cells(i,5).Value&","&.Cells(i,6).Value&","&.Cells(i,7).Value&","&.Cells(i,8).Value&","&.Cells(i,9).Value&","&.Cells(i,10).Value&","&.Cells(i,11).Value&","&.Cells(i,12).Value&","&.Cells(i,13).Value&","&.Cells(i,14).Value
          End With
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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