+ Reply to Thread
Results 1 to 4 of 4

macro to copy and move data from a list into one cell

  1. #1
    Registered User
    Join Date
    11-28-2016
    Location
    seattle
    MS-Off Ver
    2016
    Posts
    17

    macro to copy and move data from a list into one cell

    Hi,

    I need help creating a macro to generate a list of numbers for reports for another program will make. My list changes all the time. Basically I have a list of numbers that I need to combine into a list. The list is in a single excel column and I need to move the data, into a single cell. After moving the data it is separated by a semi colon and then I copy the next cell and put a semi colon behind that until I reach the end of the list. The list would look like this: 45611254:45661233;45667899

    I recorded a macro to show what I am doing. I need to add in selecting a data range that includes however many cells I used and a "next" to keep copying until the end of the range. The macro is below.


    If someone could help me do this I would be VERY grateful.


    Thank you.


    Todd





    Sub Macro1()
    '
    ' Macro1 Macro
    '
    ' Keyboard Shortcut: Ctrl+e
    '
    Range("A2").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "21310001"
    Range("E2").Select
    ActiveSheet.Paste
    ActiveCell.FormulaR1C1 = "21310001;"
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "21315016"
    Range("E2").Select
    ActiveCell.FormulaR1C1 = "21310001;"
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "21315017"
    Range("E2").Select
    ActiveCell.FormulaR1C1 = "21310001;21315016;21315017"
    Range("E3").Select
    End Sub

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: macro to copy and move data from a list into one cell

    Todd, please use CodeTags when posting code.
    Something very basic to start with.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    11-28-2016
    Location
    seattle
    MS-Off Ver
    2016
    Posts
    17

    Re: macro to copy and move data from a list into one cell

    Thank you very much! This worked perfectly.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: macro to copy and move data from a list into one cell

    Glad to help and thanks for rep+.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro to Insert Row Above Each Colored Cell in a List and Copy/Paste/Enter Data
    By thegivenbeing in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-24-2015, 03:35 PM
  2. [SOLVED] Macro to move and copy a cell to multiple rows
    By emina_c in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-15-2014, 09:59 PM
  3. Macro to move code to cell, print, then move down the list to the next code
    By MilesDeep in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2014, 04:59 PM
  4. Macro to copy from one cell and text to columns move
    By Sweepin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2013, 09:51 PM
  5. Simple macro to move data down one cell in To Do list?
    By mauxhall in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-12-2013, 09:12 AM
  6. Replies: 1
    Last Post: 12-08-2012, 05:37 PM
  7. Move/copy data from sheet1 to list in sheet2?!
    By pallar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-24-2010, 02:49 PM

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