Split Records

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,134
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have this data,

Fixed FTTH CBU Tech Compliants V1.xlsm
BCD
24Node*+Root CauseTicket Number+
25218-00_SAFAKH00OL0Access-Uplink issuePR00035914963
26PR00035915931
27Dark FiberPR00035913520
28PR00035914983
29PR00035916061
30PR00035917254
31PR00035920093
32MDTPR00035931421
33PR00035931520
34PR00035933798
35PR00035933799
36PR00035933811
37116-42_NFELRDAAOLKMan MadePR00035951924
38111-00_HTYNRD00OL5MDTPR00035909693
39PR00035923231
40Trans MediaPR00035963757
41116-42_NFELRDAAOT1Trans MediaPR00035967382
OLT2


and I have this code

VBA Code:
Sub split_recordsOLT2()
  Dim dic As Object
  Dim nCol As Long, nRow As Long, i As Long
  Dim a As Variant, b As Variant
 
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 '''''
 ''''' OLT2
 '''''
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
  Set dic = CreateObject("Scripting.Dictionary")
  a = Range("C25", Range("D" & Rows.Count).End(3)).Value
  ReDim b(1 To UBound(a, 1), 1 To 100)
 
  For i = 1 To UBound(a, 1)
    If Not dic.exists(a(i, 1)) Then
      dic(a(i, 1)) = i
      nCol = 1
    Else
      nCol = nCol + 1
    End If
    b(dic(a(i, 1)), nCol) = a(i, 2)
  Next
 
  Range("E25").Resize(UBound(b, 1), UBound(b, 2)).Value = b
End Sub

but I am looking for this output, any modification on the code.

Fixed FTTH CBU Tech Compliants V1.xlsm
BCDEFGHI
24Node*+Root CauseTicket Number+Output1Output2Output3Output4Output5
25218-00_SAFAKH00OL0Access-Uplink issuePR00035914963PR00035914963PR00035915931
26PR00035915931
27Dark FiberPR00035913520PR00035913520PR00035914983PR00035916061PR00035917254PR00035920093
28PR00035914983
29PR00035916061
30PR00035917254
31PR00035920093
32MDTPR00035931421PR00035931421PR00035931520PR00035933798PR00035933799PR00035933811
33PR00035931520
34PR00035933798
35PR00035933799
36PR00035933811
37116-42_NFELRDAAOLKMan MadePR00035951924PR00035951924
38111-00_HTYNRD00OL5MDTPR00035909693PR00035909693PR00035923231
39PR00035923231
40Trans MediaPR00035963757PR00035963757
41116-42_NFELRDAAOT1Trans MediaPR00035967382PR00035967382
OLT2
 
Debug.Print .Address
1720691218460.png
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
you probably have other data next to your data

What if you write the with line like

VBA Code:
With Range("B24", Range("D" & Rows.Count).End(xlup)).Resize(, 4)
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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