Results 1 to 18 of 18

Thread: [RESOLVED] Excell: converting comma-separated array

Threaded View

  1. #14

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    9

    Re: Excell: converting comma-separated array

    Hello again DKenny, Webtest,

    Thanks again for your support.

    To get the situation clear, I attached an example of what I have and what I need to have.

    This is how far I got:

    I understood (but not much) the VBScript you advised and this is what I'm now fronting:

    1) I have to insert N blank rows after currently analyzed cell, where N = last element in array of separated sources

    2) I have to delete source row with comma-separated values after I have my parsing done

    Overall syntax and concepts misunderstanding makes me to irk for your help again, however, this is what I tried:

    VB Code:
    1. Option Explicit
    2.  
    3. Sub arseniy_commas()
    4. Const sSeparator As String = ", " 'The value to be used to split the cells
    5.  
    6. Dim rngSource As Range
    7. Dim saResults() As String
    8. Dim rowsnumber As Long
    9. Dim lItemNum As Long
    10.  
    11.     'Start in cell C3
    12.     Set rngSource = ThisWorkbook.Worksheets(1).Range("C1")
    13.    
    14.     'Loop through all used cells in Column C
    15.     Do While rngSource.Value <> ""
    16.        
    17.         saResults = Split(rngSource.Value, sSeparator)
    18.        
    19.         'HERE I tried to set rowsnumber = UBound(saResults) and get the number
    20.         'of rows to be insterted
    21.         'HERE I tried to use ThisWorkbook.Worksheets(1).addItem rowsbunmber
    22.         'to insert blank rows of the interest
    23.                      
    24.         'Loop through each item in the array
    25.         For lItemNum = LBound(saResults) To UBound(saResults)
    26.             'Writing the value to the next cell below the source cell
    27.             rngSource.Offset(1 + lItemNum, 0).Value = saResults(lItemNum)
    28.         Next lItemNum
    29.  
    30.          
    31.         'Move to the next source cell in column
    32.         Set rngSource = rngSource.Offset(1 + lItemNum, 0)
    33.  
    34.         'HOW To delete entire row where we've just have had the source?
    35.         'Like, ThisWorkbook.Worksheets(1).RemoveItem   ??
    36.         'But the addressing will be hurt, isn't it?
    37.  
    38.        
    39.     Loop
    40.  
    41.     Set rngSource = Nothing
    42. End Sub

    Thank you again for support,

    I haven't even realized yesterday that I would go so far.
    Attached Files Attached Files
    Last edited by arseniy; Mar 28th, 2006 at 04:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width