+ Reply to Thread
Results 1 to 13 of 13

convert all the information from a part of a column to one cell with macro

  1. #1
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    convert all the information from a part of a column to one cell with macro

    Hi all,


    I want to convert all the information from a part of a column to one cell.

    I have attached an excel file with an example.

    All the comments that are behind the name in sheet 2, I want to convert in column E.
    The problem is that in sheet 2 part of the cells are merged, and that there are multiple comments for most names.
    A second problem is that the existing comments in column E must stay.

    The way the data has to be shown in column E is, how you can see in column H
    Is has to be done with macro, because after this I need to do different things with it.

    Hope someone can help me.
    Attached Files Attached Files
    Last edited by keis386; 05-23-2012 at 02:32 PM.

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: convert all the information from a part of a column to one cell with macro

    Backup your data.
    Copy code into a standard module.
    Run: CopyComments

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: convert all the information from a part of a column to one cell with macro

    keis386,

    Detach/open workbook ConvertComments w2 to wT to w1 - keis386 - EF832966 - SDG15.xlsm and run the ConvertComments macro.


    If you want to use the macro on another workbook:


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


    Please Login or Register  to view this content.

    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm


    Then run the ConvertComments macro.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: convert all the information from a part of a column to one cell with macro

    Both the macros work excellent. Only if I use the information and there is already in value in column E. Then that value is deleted. Is there a possibilty to leave that value in the cell?
    What would make it perfect is that if only the newest comments are copied in column E Sheet 1. And if there are already comments only copy the newest comments.

    See second excel sheet in attachment

  5. #5
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: convert all the information from a part of a column to one cell with macro

    second excel sheet
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: convert all the information from a part of a column to one cell with macro

    As always, backup your data.
    Copy code into a standard module.
    Run: CopyComments

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: convert all the information from a part of a column to one cell with macro

    keis386,


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


    Please Login or Register  to view this content.

    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm


    Then run the ConvertCommentsV2 macro.

  8. #8
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: convert all the information from a part of a column to one cell with macro

    Thanks you both!!

    The macros work excellent!!

    You made my day!

  9. #9
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: convert all the information from a part of a column to one cell with macro

    keis386,

    You are very welcome. Glad we could help.

    Thanks for the feedback.

    Come back anytime.

  10. #10
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: convert all the information from a part of a column to one cell with macro

    Hi,

    I implemented the macro and it works excellent. Only is it possible that if there is no comment in a cell (blank cell) that nothing will be copied to the other sheet?
    Thanks

  11. #11
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: convert all the information from a part of a column to one cell with macro

    Eh ... if there is nothing to copy, what is being copied that you don't want copied?

    Also, which code are you using? Are you using the code provided by stanleydgromjr or myself? If you are using Stanley's code, then you need to address your question to him/her. In reviewing my code, it appears to me that if it didn't find any comments, nothing else was done.
    Last edited by StevenM; 06-05-2012 at 08:00 AM.

  12. #12
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: convert all the information from a part of a column to one cell with macro

    I think I got it now.
    If there is a data without a comment, it will no longer add the date to the comments list.

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Re: convert all the information from a part of a column to one cell with macro

    Great 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