+ Reply to Thread
Results 1 to 17 of 17

Macro to move contents of cells chosen to predetermined spot on sheet.

  1. #1
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Macro to move contents of cells chosen to predetermined spot on sheet.

    I have a sheet that tracks tools along with serial numbers. The sheet is broken down into sections and depending on what section selected to move some info changes. for Example,
    I want to move the Serial Number in Cell 'A13' to to cell 'B50' -
    Then in 'A50' the Type of tool that was which is in 'A12"
    Then in Cell 'C50' the current date is placed.

    everytime you select a serial number and click the macro say Shipped it does that over again but the info goes in row 51 and so on.

    I have attached a sheet so you can get a visual.

    I have already completed the first move so you can see what it looks like,

    As you can see once it moves the contents from cell A13 down to the shipped area it leaves a blank. I would also like for the macro to adjust the rest of data in that column up so there are no empty spaces.
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    Please tell us what columns have the serial numbers. Column A for rows 13:21. What about the rest? Does B13:B21 contain serial numbers? What about the other columns in rows 13:21?

    Please do the same for other sections. Define, by range, where the Serial Numbers will be. For example G25:G33 and K25:K33.

    Also unmerge all cells and use Format Cells -> Alignment -> Horizontal -> Center Across Selection instead. Merged cells are bad news in Excel. They should be used ONLY for cosmetic purposes and not in cells that contain column headers or data.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    Sorry lets go with this, hopefully with this I can format the rest. Is there no way to copy the merged cells ...I will have to redesign the sheet if not.

    TYPE SERIAL
    A12 A13:A21
    B12 B13:B21
    C12 C13:C21
    D12 D13:D21
    E12 E13:E21
    F12 F13:F21
    G12 G13:G21
    H12 H13:H21
    I12 I13:121
    J12 J13:J21
    K12 K13:K21
    L12 L13:L21
    A24 A25:A33

    hope this helps.

  4. #4
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    Bump no response

  5. #5
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    If you merge A11 and A12, A11 alone contains the value and A12 contains nothing.
    So you can't get the TYPE data by referring to the A12 cell.

  6. #6
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    I have revised portions of the sheet trying to eliminate merged fields (I still have some to fix....Or will have to redesign the sheet again)
    But I also attached a more working version that shows part of what I am doing. If you open the sheet. highlight cell "A14" then go and use the Shipped macro.

    You will see that it takes that and moves it down to "C52" that is what I am trying to do with all of the sections on this sheet.

    Once "A14" is moved down I also need the macro to fill in the type in Cell "A52" with the info in cell "A12" at the top of that section

    Also then have to code to adjust the data from Cells "A13:A21") up to get rid of the spaces in that section.

    I hope this helps.
    Attached Files Attached Files

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    Hi bdouglas1011

    Your Code appears to be Password Protected...
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  8. #8
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    I went into mine and did not see it protected I resaved and reattahed
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    Probably this is insufficient.

    Please Login or Register  to view this content.
    Last edited by yujin; 01-29-2018 at 03:30 AM.

  10. #10
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    That is working pretty good I went ahead a rearranged the rest of the sheet to get rid of all the merged cells and I have added the other groupings below and reattached the sheet so you can see it. you way so far is working good thank you




    TYPE SERIAL NUMBER
    D25 E25
    D26 E26
    D27 E27
    D28 E28
    D29 E29
    D30 E30
    D31 E31
    D32 E32
    D33 E33

    F25 G25
    F26 G26
    F27 G27
    F28 G28
    F29 G29
    F30 G30
    F31 G31
    F32 G32
    F33 G33

    I24 I25:I33
    J24 J25:J33
    K24 K25:K33
    L24 J25:L33

    A37 A38:A44
    B37 B38:B44
    C37 C38:C44
    D37 D38:D44
    E37 E38:E44
    F37 F38:F44
    G37 G38:G44
    H37 H38:H44
    I37 I38:I44
    J37 I38:I44
    K37 K38:K44
    L37 L38:L44
    Attached Files Attached Files
    Last edited by bdouglas1011; 01-29-2018 at 05:18 AM.

  11. #11
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    I have tried adding the new ranges after re-configuring the sheet.

    My new ranges are bringing in the wrong offset for the Type...not sure how to adjust....

    added these they are like the other ranges I had.
    I25:L33, w/ the Type in row 24 -- this one is working

    A38:L46, with the type in Row 37 -- this is not working correctly -its pulls in row 36 for type

    But this ranges is different

    Type is D25:D33
    Serial Number is E25:E33
    so for the serial number in E25 use D25 for the type.

    Type is F25:F33
    Serial Number is G25:G33
    so for the serial number in G25 use F25 for the type.

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    OK, plz wait a while. I’ll deal with the problems.

  13. #13
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    I have devided Shipped macro into two parts; Shipped_Main and Shipped_Sub. Assign Shipped_Main macro to the worksheet button.

    Shipped_Sub requires two arguments, the first one is the row number of Type data and the second is the count of rows that is supposed to contain serial numbers. This works in the range of serial number cells except for E25:E33 and G25:G33.

    If you want to make Shipped_Sub work in E25:E33 or G25:G33, place '0' for the first argument and '1' for the second.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    I pasted it just as it is here and it is working in E25:E33 or G25:G33...SO i am little confused on what might need changed....But one more thing is when it sends down the serial number in those ranges can it clear out the type in the cell immediately to the left. Thank you very much for helping me on this.

  15. #15
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    I modified the code. Is this what you need?

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    It is almost.... I guess I should have been more specific.... but the Range {"D25:D33" & "E25:E33"} are together so when you shift up the ones in "D" it also needs to shift up the Cells in "E" Once a serial is put into the shipped column.....so they stay together.

    And the same for Column "F" & "G"

    Does that make sense?

  17. #17
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Macro to move contents of cells chosen to predetermined spot on sheet.

    Please replace Shipped_Sub with the following code.

    Please Login or Register  to view this content.

+ 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. Move rows to another sheet when value is chosen from a drop-down menu in cell
    By Oweineh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-25-2013, 10:01 AM
  2. Creating an automatic move to another sheet when a specific option is chosen from list
    By morgangallo in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-15-2013, 08:36 AM
  3. [SOLVED] Simple macro to create list of sheet names and the contents of cells A1 & N1 of each sheet
    By atcsmh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2013, 11:11 AM
  4. [SOLVED] Move rows to another sheet when value is chosen from a drop-down menu in cell
    By tanimytani in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2012, 07:50 AM
  5. Replies: 0
    Last Post: 06-27-2012, 05:58 AM
  6. Replies: 0
    Last Post: 12-21-2010, 05:45 PM
  7. command button to move user to specific spot on different sheet
    By grime in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-13-2006, 03:21 PM
  8. Replies: 1
    Last Post: 07-01-2005, 10:57 AM

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