Separate numbers into separate cells on another sheet

bdavis99

New Member
Joined
Apr 23, 2019
Messages
1
Hi, first time poster here...go easy! LOL
I have a spreadsheet and in the asset column i have a list of numbers related to that one line of information. All separated by a comma

[TABLE="width: 500"]
<tbody>[TR]
[TD]Number[/TD]
[TD]Title[/TD]
[TD]Rev[/TD]
[TD]Asset[/TD]
[TD]total amount of assets[/TD]
[/TR]
[TR]
[TD]UC02-WPD-UT-REP-N001-000012[/TD]
[TD]Network Design - N1[/TD]
[TD]P01[/TD]
[TD]WMI-4A-0056, WMI-4A-0063, WMI-4A-0063B, WMI-4A-0063A, WMI-4A-0062[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

My boss has now asked me to list out each Asset number separately, so i need 5 lines, but still with number, title, and rev info showing in each line. I have over 1000 separate assets, to do it manually would take ages. Is there a formula i can use.
Any help would be very much appreciated. SOrry if it is not explained very well
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try this macro. Change the sheet names (in red) to suit your needs.
Code:
Sub Test()
    Application.ScreenUpdating = False
    Dim LastRow As Long, srcWS As Worksheet, desWS As Worksheet, asset As Range, splitAssest As Variant, i As Long
    Dim bottomD As Long, bottomA As Long
    Set srcWS = Sheets("[COLOR="#FF0000"]Sheet1[/COLOR]")
    Set desWS = Sheets("[COLOR="#FF0000"]Sheet2[/COLOR]")
    LastRow = srcWS.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    desWS.Range("A1:D1") = Array("Number", "Title", "Rev", "Asset")
    For Each asset In srcWS.Range("D2:D" & LastRow)
        splitAssest = Split(asset, ", ")
        For i = LBound(splitAssest) To UBound(splitAssest)
            desWS.Cells(Rows.Count, "D").End(xlUp).Offset(1, 0) = splitAssest(i)
        Next i
        With desWS
            bottomA = .Range("A" & .Rows.Count).End(xlUp).Row
            bottomD = .Range("D" & .Rows.Count).End(xlUp).Row
            .Range("A" & bottomA + 1 & ":A" & bottomD) = asset.Offset(0, -3)
            .Range("B" & bottomA + 1 & ":B" & bottomD) = asset.Offset(0, -2)
            .Range("C" & bottomA + 1 & ":C" & bottomD) = asset.Offset(0, -1)
        End With
    Next asset
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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