+ Reply to Thread
Results 1 to 5 of 5

Copying block of data to another sheet

  1. #1
    Registered User
    Join Date
    01-10-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    11

    Copying block of data to another sheet

    Hello everybody

    I am looking out for a code where I can copy a block of data to
    the second sheet and adding the new block of data below the
    previous one.

    The block of data ranges from E6 to K15. On a click of the
    command button the data gets copied to sheet2 starting from
    A2. It will be pasted in sheet2 from A2 to G11.
    When I click the command button with the new data it will be
    added from A12 to G21 after that A22 to G31 and so on It will
    keep on adding the block.

    Can I get the problem solved

    Thanks in advance
    SParikh

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: Copying block of data to another sheet

    Hi, SParikh,

    maybe like this:
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    01-09-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Copying block of data to another sheet

    Hi SParikh,

    Try this. Assuming that Sheet1 is where u have the data & Sheet2 is where u want the data. for this code to suit u properly u have to select Range E6 and then run the code. ( If ur block of data ranges from A8 to A17 then u should select Range A8 )

    Please Login or Register  to view this content.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: Copying block of data to another sheet

    Hi, Swalih,

    besides working on the code to avoid Selection you should have mentioned that Range A2 needs to be activated in sheet2 as the pasting will always be done at the ActiveCell.

    Please Login or Register  to view this content.
    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    01-10-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Copying block of data to another sheet

    Hi! HaHoBe
    Sorry for the delay in replying back.
    I have tried your first code which is working exactly as I wanted.


    I am yet to try the other code given by Swalih. However since issue is solved by the code
    by HaHoBe do we still continue with the other available options.
    I will try again both the other codes and reply back in a day or two. But for the time being the
    the first code has solved my problem.

    Thanks a lot for reply
    HaHoBe & Swalih.

+ 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: 6
    Last Post: 10-29-2013, 12:37 AM
  2. Previous Data formula in ONE Data block that will carry each time sheet is updated
    By imagrits101 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-29-2013, 12:14 AM
  3. [SOLVED] Code from tigeravatar ,Copying data from one sheet and copying it
    By DanielRay in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-07-2012, 03:07 PM
  4. Replies: 5
    Last Post: 10-09-2012, 10:44 AM
  5. Copying a varying block from another section
    By bobparker in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-01-2006, 06:17 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