+ Reply to Thread
Results 1 to 7 of 7

VBA Macro to copy & paste non-adjacent cells from one sheet to another

  1. #1
    Registered User
    Join Date
    03-09-2014
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013
    Posts
    31

    VBA Macro to copy & paste non-adjacent cells from one sheet to another

    Hi everyone

    I have searched but cannot find an answer to my quest!

    I have two sheets, sheet1 and sheet2.

    On sheet 1 I have cells containing data but they are not consecutive. i.e. a4, b2, c3, d4, e5, j2, m9

    I also have cell A1 on sheet 1 containing a number from 1 to 50 (starting with 1)

    I need to copy the cells from sheet 1, and paste into the column number corresponding to the value in A1, with the pasted values in consecutive rows starting at row 4.. i.e. if A1= 3, the data would be pasted into column C rows 4, 5, 6, 7, 8 etc. with the number of rows being equal to the number of cells of data on sheet 1.

    I then need A1 to increment by 1

    I need the pasted cell to have the same format as the copied cell (text, general, date, time, number, etc).

    Can anyone help please?

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA Macro to copy & paste non-adjacent cells from one sheet to another

    It would be a good thing to attach a sample workbook with some data in place and desired results explicitly shown. Be carefull about sensitive material though.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    03-09-2014
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: VBA Macro to copy & paste non-adjacent cells from one sheet to another

    Hi Pierre thanks for reply. I will create an example Workbook and post tomorrow.

  4. #4
    Registered User
    Join Date
    03-09-2014
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: VBA Macro to copy & paste non-adjacent cells from one sheet to another

    Hi Pierre

    Here is a sample file (I have never posted one before so hope it works!). I have tried (haha!) to write some of the macro but am stuck on how to handle the copy/paste - cut/paste for all the cells on different sheets.

    Hope you or someone can help.

    Thanks
    Attached Files Attached Files

  5. #5
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA Macro to copy & paste non-adjacent cells from one sheet to another

    Hi,
    I don't really understand your requirements.
    Would it be possible for you to set up the Data Entry sheet with sample data and transfer some of them in the Summary sheet so I see what you want to accomplish?
    Do you really need the store the incremented number in cell C8? Can't it be local to VBA? Are you passing on some important value by this number. I don't see what it does.
    Thanks
    Regards

  6. #6
    Registered User
    Join Date
    03-09-2014
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: VBA Macro to copy & paste non-adjacent cells from one sheet to another

    Hi

    I am sorry, my explanation was rubbish! What I should have said was COPY the data from the green cells and CUT the data from the orange cells.

    I am using the Data entry sheet to record sampling point data, could be up to 100 - 150 sampling points.

    Rather than have a separate sheet for each sampling point data set it would be easier for me record the data on one sheet, with a single column for each sampling point data set.

    I was incrementing the "column number" and adding it to the Sample Point I.D. (data entry sheet cell B8) to give it a unique reference.

    Anyway, file attached, hope this makes more sense!?!

    Thanks again for taking the time to help.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-09-2014
    Location
    Manchester, England
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: VBA Macro to copy & paste non-adjacent cells from one sheet to another

    Hi Pierre

    After much scratching of the head and getting splinters, reading many forums, overloading Google and buying a VBA book I have finally achieved what I was trying to do!

    Many thanks for trying to help.

    Peter

+ 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. Replies: 1
    Last Post: 01-03-2014, 03:01 AM
  2. [SOLVED] Copy and paste comment on the adjacent cells
    By lokwungkwung in forum Excel General
    Replies: 7
    Last Post: 08-26-2013, 11:46 AM
  3. [SOLVED] find value, copy value of adjacent cell and paste it on another sheet
    By Ajgor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2012, 04:21 PM
  4. Find Adjacent Data In One Sheet and Copy/Paste Into Other Sheet
    By jaylotheman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2011, 07:19 PM
  5. Copy and paste formula into adjacent cells
    By pixifaery in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2010, 07:25 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