VBA to Create Custom List

Indians1022

New Member
Joined
Aug 15, 2018
Messages
7
Hello,

I am a beginner to VBA and I am in need of some help to create a code. I have a file that contains thousands of ID's that need to be put into a list that shows each ID included in each group. The ID's are broken up in sections based off of similar products. I need to create a list that will give me all of the ID's for the particular section on one line for each separate ID. I have included a small example that shows how the list is currently set up(on left) in excel and what I need the list to look like. The SOLEOL(Start of List, End of List) is the indicator of new group of similar products. I apologize for the poor example. I am new to this site and do not know how to insert better example. Any help would be greatly appreciated. Thank you!
[TABLE="width: 121"]
<tbody>[TR]
[TD]
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 524"]
<tbody>[TR]
[TD]SOLEOL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]785901824624135[/TD]
[TD][/TD]
[TD]785901824624135[/TD]
[TD] 786678231114135[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]786678231114135[/TD]
[TD][/TD]
[TD]786678231114135[/TD]
[TD] 785901824624135[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SOLEOL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]749761360204135[/TD]
[TD][/TD]
[TD]749761360204135[/TD]
[TD] 785901871824135[/TD]
[TD] 786678231134135[/TD]
[/TR]
[TR]
[TD]785901871824135[/TD]
[TD][/TD]
[TD]785901871824135[/TD]
[TD] 786678231134135[/TD]
[TD] 749761360204135[/TD]
[/TR]
[TR]
[TD]786678231134135[/TD]
[TD][/TD]
[TD]786678231134135[/TD]
[TD] 749761360204135[/TD]
[TD] 785901871824135[/TD]
[/TR]
[TR]
[TD]SOLEOL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]785901864624135[/TD]
[TD][/TD]
[TD]785901864624135[/TD]
[TD] 786678231144135[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]786678231144135[/TD]
[TD][/TD]
[TD]786678231144135[/TD]
[TD] 785901864624135[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SOLEOL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Code:
Sub TradeData()
Dim x As Long
 
Range("C1:D28").Clear
For x = 1 To 28
 
    If Cells(x, 1) = "SOLEOL" Then
        Cells(x, 3) = ""
    Else
        Cells(x, 3) = "=A:A"
    End If    
Next x
 
End Sub

I am able to get the first column of my expected results fine but my main problem is figuring out how to code the module so that the second and third column of results will also correctly calculate. All of my other attempts have resulted in the same ID for every column. Thank you again for any help or input you might have.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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