+ Reply to Thread
Results 1 to 12 of 12

Copy only Used Parts of a Range

  1. #1
    Registered User
    Join Date
    12-19-2009
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2003
    Posts
    6

    Copy only Used Parts of a Range

    I'm making a project where there's a list of skills and next to each skill is a cell where the user can put how many skill points are in that particular skill. Now, on a separate worksheet is the place where it shows the consolidation of what skills they know, and how many points are in each. My question is, how can I copy over these skills and how many ranks are in each, without copying over the skills in which they put no points.

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Copying only Used Parts of a Range

    If you have a first Worksheet that looks like

    HTML Code: 
    ... then please explain
    shows the consolidation of what skills they know
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Registered User
    Join Date
    12-19-2009
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Copying only Used Parts of a Range

    My list of the skill names are simply A121:A218 on a worksheet called Design, and their skill levels are B121:B128 on the same worksheet. There is only one person who has the skills, with the skill name being on the left, and their skill level being on the right. The destinations of the skill names are BI16:BI148, where rows are merged into twos (the cells are BI16, BI18, BI20) and the destinations of their corresponding levels are CD16:CD148, where the rows are once again merged into twos. Their destinations are on a worksheet called Character Sheet I. I'm not sure how to do the HTML thing you did, but if that's what you were looking for, let me know how and I will.
    Last edited by someone3426; 12-19-2009 at 06:07 PM. Reason: Didn't think the original message was clear enough.

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Copying only Used Parts of a Range

    You'll get a precise solution much faster if you upload a sample workbook (desensitize the data) that duplicates your current structure exactly and manually shows the desired results.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  5. #5
    Registered User
    Join Date
    12-19-2009
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Copying only Used Parts of a Range

    Is this what you're looking for? (I'm new here, and not generally good at posting in forums.)
    Attached Files Attached Files

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copying only Used Parts of a Range

    Hello someone3426,

    Copy the macro into a VBA module and then add a button to your worksheet and attach the macro to it.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 12-21-2009 at 02:58 PM. Reason: Forum doesn't like the letters C & D together, Replaced columns with numbers
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Registered User
    Join Date
    12-19-2009
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Copying only Used Parts of a Range

    Thank you for that, and I think I see what you're doing. I tried it, and it didn't work. But then I'd tried doing a few things with it. First of all, it's the character sheet is capital I, not number 1. Second of all, I changed the initial value of N to 0, not 16 (why make the range start at 16, and then offset it another 16). After doing these, it would successfully copy the first skill that I had put points into, but none others. Then I changed the x-offset for where the amount of points go to 16 (that makes it end up in the correct box), but it would still only copy the first skill. Then, don't ask why, I tried changing the "N = N + 2" to "N = N + 1", and then it copied the first two used skills successfully, but none others. Any thoughts onto why this is happening? Btw, thanks for all the help so far.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copying only Used Parts of a Range

    Hello someone3426,

    The macro was written not to be used with the sample workbook you posted, but with the workbook parameters given here:
    My list of the skill names are simply A121:A218 on a worksheet called Design, and their skill levels are B121:B128 on the same worksheet. There is only one person who has the skills, with the skill name being on the left, and their skill level being on the right. The destinations of the skill names are BI16:BI148, where rows are merged into twos (the cells are BI16, BI18, BI20) and the destinations of their corresponding levels are CD16:CD148, where the rows are once again merged into twos. Their destinations are on a worksheet called Character Sheet I.
    It was my understanding you wanted code written for these criteria and the sample workbook was basically for reference.

  9. #9
    Registered User
    Join Date
    12-19-2009
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Copying only Used Parts of a Range

    I did use the workbook with those parameters, it still didn't work. From what I can see the code trying to do, I have no idea why it's not working, it should be doing its job perfectly, but it's not. Unless there's something I'm missing, which there usually is.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copying only Used Parts of a Range

    Hello someone3426,

    I change the ranges in the code to work with example workbook you post and it ran correctly. If you post your workbook, I can review the code to find the problem. Remove or change any information that is confidential or sensitive before posting the workbook.

  11. #11
    Registered User
    Join Date
    12-19-2009
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Copying only Used Parts of a Range

    Here's the Original Project.
    Attached Files Attached Files

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Copying only Used Parts of a Range

    Hello someone3426,

    Now I see why it didn't work. You don't need a VBA macro solution. Your work book is using numerous named ranges and formulae to link the data. On the sheet "Character Sheet I" the skill name can be hidden using an "IF" formula in the "Ranks" column "CN" if the "Skill Name in column "BI" is empty. Because you have chosen to merge 2 rows for each rank, you can not simply drag the formula down the range. You will have to enter each formula for each rank. Here is the formula for the first rank..

    CN16=IF(BI16<>"",Design!B121,"")

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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