+ Reply to Thread
Results 1 to 8 of 8

Copy specific cells from one worksheet to another worksheet

  1. #1
    Registered User
    Join Date
    07-21-2017
    Location
    NY
    MS-Off Ver
    16.0
    Posts
    25

    Copy specific cells from one worksheet to another worksheet

    Hi everyone, need some help with this VBA code!

    What I want to do is copy cells from a worksheet (i.e. "Input") to another worksheet (i.e. "Output") when a specific variable is entered into a specific column.

    Whenever a "1" is entered by a user (in Yes/No i.e. E, J, O etc.), I want the code to copy the matching varible under table name (in column B, G, L) to a new worksheet where these variables will form a new table for all entries with a "1" entered. I have attached an Excel sheet and the output should look like the new worksheet "Output" after the code is run. Obviously it would be blank to begin with as nothing is changed from 0 to 1 yet. The new worksheet should update automatically in real time when 0's and 1's are entered into "Input", so there shouldn't need to create a button.

    Aside from the Yes/No column, there is a Low and High column for Tables 9, 10, 11. For these, it should only look the data inputted into the 8th row, i.e. AU8, AV8, AZ8, BA8, BE8, and BF8. And rather than taking only "1", these cells should take any number (even 0) as long as Low and High are different. If they are the same, then don't move either to "Output" worksheet because no numerical range is being selected.

    Any help on the code is much appreciated!

    The code below is what I've tried to do so far, but it obviously hasn't worked.

    In Module:

    Please Login or Register  to view this content.
    -------
    In Sheet 1 ("Input"):

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

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,483

    Re: Copy specific cells from one worksheet to another worksheet

    Probably just setting it up for each target.range would work as well

    Please Login or Register  to view this content.
    By the way,
    Please Login or Register  to view this content.
    The only variable properly set as a range would be fndRng, everything else would not be considered ranges.
    Please Login or Register  to view this content.
    Last edited by davesexcel; 07-24-2017 at 09:30 AM.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,248

    Re: Copy specific cells from one worksheet to another worksheet

    Hey jos283...well done...You were very close...
    Try this...
    Please Login or Register  to view this content.
    Keep your worksheet code as is...

    Edit:
    As per davesexcel....all the other rng's will be declared as Variant which generally will be accepted until it bombs out somewhere.

    PS...What about the sample workbook in this post...Is it the same requirement but is this the original file..
    https://www.excelforum.com/excel-pro...ml#post4702759
    Last edited by sintek; 07-24-2017 at 01:48 PM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Registered User
    Join Date
    07-21-2017
    Location
    NY
    MS-Off Ver
    16.0
    Posts
    25

    Re: Copy specific cells from one worksheet to another worksheet

    Sintek -

    Yes, pretty much the same thing but an extended version of it with a few extra criteria.

    Thanks, I've adjusted it to suit my requirements but the code works again!

  5. #5
    Registered User
    Join Date
    07-21-2017
    Location
    NY
    MS-Off Ver
    16.0
    Posts
    25

    Re: Copy specific cells from one worksheet to another worksheet

    For the final 3 tables:

    Output.png

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,248

    Re: Copy specific cells from one worksheet to another worksheet

    Please Login or Register  to view this content.

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Copy specific cells from one worksheet to another worksheet

    Hello jos283,

    Do you know if there is a way to get the output to look like this so that the table only uses two columns instead of three
    That is where the problem lies. With the conditions set for the Min and Max conditions.

    B.t.w. this Code of yours below;

    Please Login or Register  to view this content.
    Should actually read;

    Please Login or Register  to view this content.
    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  8. #8
    Registered User
    Join Date
    07-21-2017
    Location
    NY
    MS-Off Ver
    16.0
    Posts
    25

    Re: Copy specific cells from one worksheet to another worksheet

    Thanks, spotted that!

+ 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] Copy specific cells from one worksheet to another worksheet
    By jos283 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-21-2017, 07:35 AM
  2. [SOLVED] VBA to copy paste to specific worksheet from another workbook of same worksheet name
    By saleembasha in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-21-2015, 10:37 AM
  3. Replies: 8
    Last Post: 10-27-2014, 11:27 PM
  4. Macro to copy specific cells from diff worksheet
    By asach1211 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2014, 09:55 AM
  5. Copy ranges and specific cells into one worksheet
    By asach1211 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-19-2014, 02:28 AM
  6. Replies: 3
    Last Post: 06-17-2013, 06:00 AM
  7. Copy Specific Cells To Another Worksheet
    By MARY-20 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-06-2013, 02:45 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