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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,216,759
Messages
6,132,556
Members
449,735
Latest member
Gary_M

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