Results 1 to 7 of 7
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Join cells do until... (2000 sr 1)

    Admit i have in column A (MATR. is cell A1) and i dont know ho many value are after A1 how to cicle the range A2:A.... and store in My_var rthe string similar OI17970;OI19673, after the last cell in A is blank exit from the join...
    Hope i am clear.

    MATR.
    OI17970
    OI19673

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Join cells do until... (2000 sr 1)

    Do you want the end result to contain only the first and last item, or all items in the column?

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Join cells do until... (2000 sr 1)

    All in column... after A2

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Join cells do until... (2000 sr 1)

    Work fine...

    lost "_" in first piece of code;-)
    Si

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Join cells do until... (2000 sr 1)

    Edited by HansV to correct error

    Try this:
    <code>
    Dim My_Var As String
    Dim R As Long
    For R = 2 To Range("A65536").End(xlUp).Row
    My_Var = My_Var & ";" & Range("A" & R)
    Next R
    If Not My_Var = "" Then
    ' Remove first ;
    My_Var = Mid(My_Var, 2)
    End If
    </code>
    If the worksheet is not the active one, you must specify it in the code: use Worksheets("...").Range("...") instead of Range("..."). You must substitute the correct name, of course.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Join cells do until... (2000 sr 1)

    It was air code! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Join cells do until... (2000 sr 1)

    ... sure i know!

Posting Permissions

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