+ Reply to Thread
Results 1 to 10 of 10

Macro to copy selected cells to another sheet.

  1. #1
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Macro to copy selected cells to another sheet.

    I have attached a workbook which I have changed from an original and need some help to edit/create a new macro
    in order to move specific data from one sheet to the other.
    So in the Kit totals sheet if A2,4,6,8 etc has data that should be copied to the next empty cell in Pricing colum E
    So in the Kit totals sheet if N2,4,6,8 etc has data that should be copied to the next empty cell in Pricing colum P
    (all the info in these rows and more is pulled from another sheet with another macro) All the cells could have info in them
    but I only need what is in E & P in the pricing sheet. I have added kit 1,2,3 in the cells I am trying to get the information to populate.

    Thanks in advance for any help.
    Attached Files Attached Files
    Last edited by And180y; 12-05-2021 at 11:00 PM.

  2. #2
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Macro to copy selected cells to another sheet.

    Please Login or Register  to view this content.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  3. #3
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro to copy selected cells to another sheet.

    Thankyou so much, works perfect. If kit sheet had more rows filled in will I need to change anything?

  4. #4
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Macro to copy selected cells to another sheet.

    Please Login or Register  to view this content.
    red part = always exact 14 columns wide.
    green part : number of rows is determined by currentregion = block of cells that is bounded by an empty row or column, thus autosize itself.
    brown part : start at the 2nd row

    Answer : you don't have to change anything when you add more rows.
    Last edited by bsalv; 12-05-2021 at 10:18 PM.

  5. #5
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro to copy selected cells to another sheet.

    bsalv, thanks so much for your help and direction. :-)

  6. #6
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro to copy selected cells to another sheet.

    I wonder if anyone can help, bsalv gave me a solution to the original sheet which I am sure worked fine but
    some how, (not sure if by moving sheets) now it doesnt work. Hoping someone could take a quick look and
    explain whats gone wrong. T.I.A.
    I have manually inserted the data into the pricing sheet which should fill from the Kit sheet to show the desired result.
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to copy selected cells to another sheet.

    I run the code in both attached and appears to work. The sheet names and layouts on comments 1 and 6 are the same, so I could not see any difference or issue.

  8. #8
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro to copy selected cells to another sheet.

    Thanks AB33, When I run the macro this is the result not, sure whats gone wrong if you are getting the result in the 2nd pic?

    Attachment 764750


    I should/used to get Attachment 764751

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to copy selected cells to another sheet.

    I can't open the pictures. Please attach the sample you are not getting the desired result.

  10. #10
    Forum Contributor
    Join Date
    02-28-2020
    Location
    Inverness, Scotland
    MS-Off Ver
    365
    Posts
    308

    Re: Macro to copy selected cells to another sheet.

    AB33, sincere apologies for wasting your time. I had locked my sheet and had scroll locks
    on it as well thus not allowing the macro to run as intended. Thanks for your help.

+ 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 loop through sheet and copy selected columns to another sheet
    By rrafluap in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-09-2021, 07:44 PM
  2. VBA to copy row (or selected cells) from one sheet to another
    By A.Walloper in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-06-2020, 10:55 AM
  3. [SOLVED] Copy Selected cells to another sheet
    By COURTTROOPER in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-28-2018, 05:33 PM
  4. [SOLVED] Copy Value from selected cells to a new workbook sheet
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2013, 11:33 AM
  5. copy selected cells to new sheet
    By sad212 in forum Excel General
    Replies: 0
    Last Post: 06-11-2012, 02:45 PM
  6. copy selected cells to new sheet in a row using macro
    By cvsuryam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2011, 04:11 PM
  7. Replies: 2
    Last Post: 08-08-2006, 12:50 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