+ Reply to Thread
Results 1 to 12 of 12

Copy only Used Parts of a Range

Hybrid View

  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.
    Sub CopySkills()
    
      Dim DstRng As Range
      Dim I As Long
      Dim N As Long
      Dim SrcRng As Range
      
        Set SrcRng = Worksheets("Design").Range("A121:A218")
        Set DstRng = Worksheets("Character Sheet 1").Range("BI16")
         
         N = 16
         For I = 1 To SrcRng.Rows.Count
           If SrcRng.Cells(I, 2) <> 0 Then
              DstRng.Offset(N, 0) = SrcRng.Cells(I, 1)
              DstRng.Offset(N, 21) = SrcRng.Cells(I, 2)
              N = N + 2
           End If
         Next I
         
    End Sub
    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!)

+ 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