Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 149389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:07:23+00:00 2026-05-11T09:07:23+00:00

I need your help in this case: I have: 1 11 111 Cat1 a,b,c

  • 0

I need your help in this case:

I have:

1    11    111    Cat1 a,b,c  2    22    222    Cat2 d  3    33    333    Cat3 e,f  4    44    444    Cat4 g,h,i 

and i want:

1    11    111    Cat1 a  1    11    111    Cat1 b  1    11    111    Cat1 c  2    22    222    Cat2 d  3    33    333    Cat3 e  3    33    333    Cat3 f  4    44    444    Cat4 g  4    44    444    Cat4 h  4    44    444    Cat4 i 

you can help me to make this macro? I have written 5 columns but i need the macro for 20 columns but the best will be that i can choose the number of columns in the macro.

Its near that this case but with more columns: Excel Macro – Comma Separated Cells to Rows Preserve/Aggregate Column

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:07:23+00:00Added an answer on May 11, 2026 at 9:07 am

    This code should be what you are looking for, the method ExpandData(String, String, String) takes the start column for the set of data (in this case ‘A’) for the first parameter, the end column for the set of data to copy as the second parameter (in this case ‘D’) and finally the column with the set of data that is comma seperated (‘E’ here).

    You should probably expand it so that it also takes a starting row or just make it an addin formula thing where it takes a range and a column.

    Hope this helps.

    Sub ExpandDat()     ExpandData 'A', 'D', 'E' End Sub  Sub ExpandData(start_range As String, end_range As String, comma_column As String)     Const FirstRow = 1     Dim LastRow As Long     LastRow = Range(start_range & CStr(Rows.Count)).End(xlUp).Row      ' Get the values from the worksheet '     Dim SourceRange As Range     Set SourceRange = Range(start_range & CStr(FirstRow) & ':' & end_range & CStr(LastRow))      ' Get the comma seperated values as a different set of values '     Dim CommaRange As Range     Set CommaRange = Range(comma_column & CStr(FirstRow) & ':' & comma_column & CStr(LastRow))      ' Get the values from the actual values '     Dim Vals() As Variant     Vals = SourceRange.Value      ' We need to know the upper and lower bounds of the second dimension in the Vals Array '     Dim lower As Integer     Dim upper As Integer     lower = LBound(Vals, 2)     upper = UBound(Vals, 2)      ' Get the comma seperated values '     Dim Commas() As Variant     Commas = CommaRange.Value      ' Loop through the rows in the array and split each comma-delimited list of items and put each on its own row '     Dim ArrIdx As Long     Dim RowCount As Long     For ArrIdx = LBound(Commas, 1) To UBound(Commas, 1)          Dim CurrList As String         CurrList = Replace(Commas(ArrIdx, 1), ' ', '')          ' Split the Comma set into an array '         Dim ListItems() As String         ListItems = Split(CurrList, ',')          ' For each value in the Comma Seperated values write the output '         Dim ListIdx As Integer         For ListIdx = LBound(ListItems) To UBound(ListItems)             ' Loop through the values in our source range and output them '             For Idx = lower To upper                 Range(start_range & CStr(FirstRow + RowCount)).Offset(0, Idx - 1).Value = Vals(ArrIdx, Idx)             Next Idx              Range(comma_column & CStr(FirstRow + RowCount)).Value = ListItems(ListIdx)             RowCount = RowCount + 1          Next ListIdx      Next ArrIdx  End Sub 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need your help to understand this better. This is my case. I have
Hello i have the this problem, i need your help to figure out what
I really need your help for this. I am relatively new to programming and
ive being trying to cope with this problem but still. I need your help.
I need your help, For example I have a decimal type variable and I
I need your help to define a special case in XML schema: A sequence
I've some questions .. and I really need your help. I have an application.
today i need your help to get an specific sql select query. i have
Hi, ive been dealing with this for some time now and need your help.
I need your help to optimize the query below. Let us assume we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.