+ Reply to Thread
Results 1 to 6 of 6

Copy range to other sheet depending on entry in cell

  1. #1
    Registered User
    Join Date
    03-17-2016
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    3

    Copy range to other sheet depending on entry in cell

    Hello,

    I recently discovered VBA.
    I want to write values froms cells C4:C10 to another sheet, depending on the number given in C2.
    On the next worksheet (ws2), I have number 1 to 10. If the number in the first row is the same as given in C2, then the values (C4:10) need to be copied in the cells below that number.

    I already got a code to find the the same number:
    Please Login or Register  to view this content.
    Many thanks! *How can I add an attachment to this post?
    screenshot excel test.png screenshot excel test2.png Test.xlsm
    Last edited by RutgerdV; 03-17-2016 at 05:49 AM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Copy range to other sheet depending on entry in cell

    Try:
    Please Login or Register  to view this content.
    and please edit your post to comply with http://www.excelforum.com/forum-rule...rum-rules.html by using code tags
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    03-17-2016
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    3

    Re: Copy range to other sheet depending on entry in cell

    Thanks, got it working with some adjustments:
    Please Login or Register  to view this content.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Copy range to other sheet depending on entry in cell


    As Destination is first (and only) parameter in Range.Copy method name of the parameter can be skipped, so
    Please Login or Register  to view this content.
    is exactly the same as:
    Please Login or Register  to view this content.
    see how you use MsgBox - for instance you wrote:
    Please Login or Register  to view this content.
    extended version would be:
    Please Login or Register  to view this content.
    ---------------

    Glad it worked, and also from code tags usage in post #3. What I asked before (and ask again) is to push "Edit Post" button below your first post and use code tags also there.

    PS. As you have action for both "found" and "not found" have a look on soch "inversion" in the code:
    Please Login or Register  to view this content.
    I added also second (optional) parameter to MsgBox to emphasize that it is a warning message

  5. #5
    Registered User
    Join Date
    03-17-2016
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    3

    Re: Copy range to other sheet depending on entry in cell

    Thanks you really helped me!

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Copy range to other sheet depending on entry in cell

    Glad to hear that.
    So 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. Check cell value in range, depending on condition copy to another Sheet
    By KemalO in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2015, 11:01 AM
  2. Replies: 0
    Last Post: 03-24-2014, 07:31 AM
  3. [SOLVED] Copy & paste entire row to different sheet based on cell entry
    By XxCMoneyxX in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-14-2013, 07:52 PM
  4. [SOLVED] Copy cell from 1 sheet to another sheet depending on what info is displayed in a cell
    By chilli76 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-24-2013, 12:33 PM
  5. Macro to copy data from one sheet to another depending on name in first cell
    By subtilty in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2013, 07:44 AM
  6. [SOLVED] IF forumla - need to populate a cell on one sheet depending on range of cells in another
    By Emma2902 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-14-2012, 07:43 AM
  7. Copy a range to different sheets depending on first cell contents
    By WaveOfMutilation in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 03-01-2010, 12:58 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