+ Reply to Thread
Results 1 to 5 of 5

merging cells and formating text.

  1. #1
    Daniel M
    Guest

    merging cells and formating text.

    I have data in 2 columns that i need to merge.

    IE:
    A B
    234 245

    needs to be:
    234245

    Now i know i can concantenate the data but then i'm stuck.

    The data can be of any number of rows, so i need to select only the cells
    with data in them. I then have to take the data and transpose it.

    IE:
    A
    234
    456
    689

    needs to be:
    A B C
    234 456 689.

    This way i can save it as comma delimited and import it into another source.
    Basically i need my ending data to be 123,345,677,8984.

    Any ideas on how to get this all done? I would like to make it a macro so i
    dont have to manually do it each time. thanks.



  2. #2
    Tim Coddington
    Guest

    Re: merging cells and formating text.

    If the cursor is in the column in question, how zabout ...
    --------------------------------------------
    Private Sub CLDColumn()
    Dim CDLString$

    Cells(65536, ActiveCell.Column).End(xlUp).Select
    Do Until ActiveCell.Row = 1
    CDLString$ = "," & ActiveCell.Value & CDLString$
    ActiveCell.Offset(-1, 0).Select
    Loop
    CDLString$ = ActiveCell.Value & CDLString$
    End Sub
    --------------------------------------------
    Then, assuming it isn't a very long string, just open a file and write it?

    "Daniel M" <[email protected]> wrote in message
    news:[email protected]...
    > I have data in 2 columns that i need to merge.
    >
    > IE:
    > A B
    > 234 245
    >
    > needs to be:
    > 234245
    >
    > Now i know i can concantenate the data but then i'm stuck.
    >
    > The data can be of any number of rows, so i need to select only the cells
    > with data in them. I then have to take the data and transpose it.
    >
    > IE:
    > A
    > 234
    > 456
    > 689
    >
    > needs to be:
    > A B C
    > 234 456 689.
    >
    > This way i can save it as comma delimited and import it into another

    source.
    > Basically i need my ending data to be 123,345,677,8984.
    >
    > Any ideas on how to get this all done? I would like to make it a macro so

    i
    > dont have to manually do it each time. thanks.
    >
    >




  3. #3
    Daniel M
    Guest

    Re: merging cells and formating text.

    This doesnt seem to work right, it goes to the bottom of the lister and
    starts moving up but then stops when it is done. doing nothing. Once again
    here is my data...

    2 columns
    a b
    212 2132
    213 21321
    465 1669
    7948 8989

    This goes on for 40+ lines.

    i then need the data to be in one cell merged together like so...

    2122132
    21321321
    4651669
    79488989
    ....

    once done i need the data to be transposed like so...

    a b c d...
    2122132 21321321 4651669 79488989...


    "Tim Coddington" <[email protected]> wrote in message
    news:[email protected]...
    > If the cursor is in the column in question, how zabout ...
    > --------------------------------------------
    > Private Sub CLDColumn()
    > Dim CDLString$
    >
    > Cells(65536, ActiveCell.Column).End(xlUp).Select
    > Do Until ActiveCell.Row = 1
    > CDLString$ = "," & ActiveCell.Value & CDLString$
    > ActiveCell.Offset(-1, 0).Select
    > Loop
    > CDLString$ = ActiveCell.Value & CDLString$
    > End Sub
    > --------------------------------------------
    > Then, assuming it isn't a very long string, just open a file and write it?
    >
    > "Daniel M" <[email protected]> wrote in message
    > news:[email protected]...
    >> I have data in 2 columns that i need to merge.
    >>
    >> IE:
    >> A B
    >> 234 245
    >>
    >> needs to be:
    >> 234245
    >>
    >> Now i know i can concantenate the data but then i'm stuck.
    >>
    >> The data can be of any number of rows, so i need to select only the cells
    >> with data in them. I then have to take the data and transpose it.
    >>
    >> IE:
    >> A
    >> 234
    >> 456
    >> 689
    >>
    >> needs to be:
    >> A B C
    >> 234 456 689.
    >>
    >> This way i can save it as comma delimited and import it into another

    > source.
    >> Basically i need my ending data to be 123,345,677,8984.
    >>
    >> Any ideas on how to get this all done? I would like to make it a macro so

    > i
    >> dont have to manually do it each time. thanks.
    >>
    >>

    >
    >




  4. #4
    Tim Coddington
    Guest

    Re: merging cells and formating text.

    Ooooh. Must have misunderstood the problem. But you were able to view the
    CDLString$, weren't you in the debugger?

    So try again. Perhaps you could put a formula in column c to help? Like
    =A1&B1 in each row? Then go something like ...
    Sub trytranspose()
    Range("C1:C4").Copy 'Only for the C4 use the end(xlup) trick
    [D1].PasteSpecial xlPasteValues, , , True 'Here, there must be fewer
    than 256 - 3 columns used = 252 rows
    End Sub
    My sample comes out like ...
    212
    2132
    2122132
    2122132
    21321321
    4651669
    79488989

    213
    21321
    21321321





    465
    1669
    4651669





    7948
    8989
    79488989






    May need to delete those first three columns so the array starts at [A1]
    "Daniel M" <[email protected]> wrote in message
    news:[email protected]...
    > This doesnt seem to work right, it goes to the bottom of the lister and
    > starts moving up but then stops when it is done. doing nothing. Once again
    > here is my data...
    >
    > 2 columns
    > a b
    > 212 2132
    > 213 21321
    > 465 1669
    > 7948 8989
    >
    > This goes on for 40+ lines.
    >
    > i then need the data to be in one cell merged together like so...
    >
    > 2122132
    > 21321321
    > 4651669
    > 79488989
    > ...
    >
    > once done i need the data to be transposed like so...
    >
    > a b c d...
    > 2122132 21321321 4651669 79488989...
    >
    >
    > "Tim Coddington" <[email protected]> wrote in message
    > news:[email protected]...
    > > If the cursor is in the column in question, how zabout ...
    > > --------------------------------------------
    > > Private Sub CLDColumn()
    > > Dim CDLString$
    > >
    > > Cells(65536, ActiveCell.Column).End(xlUp).Select
    > > Do Until ActiveCell.Row = 1
    > > CDLString$ = "," & ActiveCell.Value & CDLString$
    > > ActiveCell.Offset(-1, 0).Select
    > > Loop
    > > CDLString$ = ActiveCell.Value & CDLString$
    > > End Sub
    > > --------------------------------------------
    > > Then, assuming it isn't a very long string, just open a file and write

    it?
    > >
    > > "Daniel M" <[email protected]> wrote in message
    > > news:[email protected]...
    > >> I have data in 2 columns that i need to merge.
    > >>
    > >> IE:
    > >> A B
    > >> 234 245
    > >>
    > >> needs to be:
    > >> 234245
    > >>
    > >> Now i know i can concantenate the data but then i'm stuck.
    > >>
    > >> The data can be of any number of rows, so i need to select only the

    cells
    > >> with data in them. I then have to take the data and transpose it.
    > >>
    > >> IE:
    > >> A
    > >> 234
    > >> 456
    > >> 689
    > >>
    > >> needs to be:
    > >> A B C
    > >> 234 456 689.
    > >>
    > >> This way i can save it as comma delimited and import it into another

    > > source.
    > >> Basically i need my ending data to be 123,345,677,8984.
    > >>
    > >> Any ideas on how to get this all done? I would like to make it a macro

    so
    > > i
    > >> dont have to manually do it each time. thanks.
    > >>
    > >>

    > >
    > >

    >
    >




  5. #5
    Tim Coddington
    Guest

    Re: merging cells and formating text.

    OK. So when I copied the sample into the last e-mail message, it kind of
    messed it up. Please ignore.
    But by what method were you taking the data and writing it to the .CDL file?

    "Tim Coddington" <[email protected]> wrote in message
    news:[email protected]...
    > Ooooh. Must have misunderstood the problem. But you were able to view

    the
    > CDLString$, weren't you in the debugger?
    >
    > So try again. Perhaps you could put a formula in column c to help? Like
    > =A1&B1 in each row? Then go something like ...
    > Sub trytranspose()
    > Range("C1:C4").Copy 'Only for the C4 use the end(xlup) trick
    > [D1].PasteSpecial xlPasteValues, , , True 'Here, there must be fewer
    > than 256 - 3 columns used = 252 rows
    > End Sub
    > My sample comes out like ...
    > 212
    > 2132
    > 2122132
    > 2122132
    > 21321321
    > 4651669
    > 79488989
    >
    > 213
    > 21321
    > 21321321
    >
    >
    >
    >
    >
    > 465
    > 1669
    > 4651669
    >
    >
    >
    >
    >
    > 7948
    > 8989
    > 79488989
    >
    >
    >
    >
    >
    >
    > May need to delete those first three columns so the array starts at [A1]
    > "Daniel M" <[email protected]> wrote in message
    > news:[email protected]...
    > > This doesnt seem to work right, it goes to the bottom of the lister and
    > > starts moving up but then stops when it is done. doing nothing. Once

    again
    > > here is my data...
    > >
    > > 2 columns
    > > a b
    > > 212 2132
    > > 213 21321
    > > 465 1669
    > > 7948 8989
    > >
    > > This goes on for 40+ lines.
    > >
    > > i then need the data to be in one cell merged together like so...
    > >
    > > 2122132
    > > 21321321
    > > 4651669
    > > 79488989
    > > ...
    > >
    > > once done i need the data to be transposed like so...
    > >
    > > a b c d...
    > > 2122132 21321321 4651669 79488989...
    > >
    > >
    > > "Tim Coddington" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > If the cursor is in the column in question, how zabout ...
    > > > --------------------------------------------
    > > > Private Sub CLDColumn()
    > > > Dim CDLString$
    > > >
    > > > Cells(65536, ActiveCell.Column).End(xlUp).Select
    > > > Do Until ActiveCell.Row = 1
    > > > CDLString$ = "," & ActiveCell.Value & CDLString$
    > > > ActiveCell.Offset(-1, 0).Select
    > > > Loop
    > > > CDLString$ = ActiveCell.Value & CDLString$
    > > > End Sub
    > > > --------------------------------------------
    > > > Then, assuming it isn't a very long string, just open a file and write

    > it?
    > > >
    > > > "Daniel M" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > >> I have data in 2 columns that i need to merge.
    > > >>
    > > >> IE:
    > > >> A B
    > > >> 234 245
    > > >>
    > > >> needs to be:
    > > >> 234245
    > > >>
    > > >> Now i know i can concantenate the data but then i'm stuck.
    > > >>
    > > >> The data can be of any number of rows, so i need to select only the

    > cells
    > > >> with data in them. I then have to take the data and transpose it.
    > > >>
    > > >> IE:
    > > >> A
    > > >> 234
    > > >> 456
    > > >> 689
    > > >>
    > > >> needs to be:
    > > >> A B C
    > > >> 234 456 689.
    > > >>
    > > >> This way i can save it as comma delimited and import it into another
    > > > source.
    > > >> Basically i need my ending data to be 123,345,677,8984.
    > > >>
    > > >> Any ideas on how to get this all done? I would like to make it a

    macro
    > so
    > > > i
    > > >> dont have to manually do it each time. thanks.
    > > >>
    > > >>
    > > >
    > > >

    > >
    > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1