+ Reply to Thread
Results 1 to 8 of 8

Unique, random selections from one sheet to another

Hybrid View

  1. #1
    Registered User
    Join Date
    08-18-2011
    Location
    Denver Colorado
    MS-Off Ver
    Excel 2007
    Posts
    65

    Re: Unique, random selections from one sheet to another

    Okay, I realize no one wants to do someone's work for them. I've puzzled out my numbering issue and a way to include my blank spaces on the Checklog sheet. I've even adapted some code from this forum to make a random selection of my initial data (Thank you MarvinP). I'm still stuck on two things with this piece of my puzzle. Firstly, how do I code in the variable to select 100% of the items that are over one year old or missing an inventory date, or a unique selection equaling 5% of the total inventory? This could mean a combination of both items (i.e. there's one item over 365 days old, but I need to choose 5 items to validate). Secondly, how do I include the variable to randomly select only the items showing "IN USE" on Column D of the Checklog tab?

    Here's my code, as it is:
    Sub Random()
    Dim LastRowSht1 As Double
    Dim Ctr As Double
    Dim RandRow As Double
    Dim x As Range
    
    Worksheets("Sheet1").Cells.ClearContents
    Set x = Range("checklog!D3")
    For Ctr = 1 To x
        RandRow = WorksheetFunction.RandBetween(5, Cells(Rows.Count, "A").End(xlUp).Row)
        LastRowSht1 = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row + 1
        Range("A" & RandRow & ":F" & RandRow).Copy _
            Destination:=Worksheets("Sheet1").Range("A" & LastRowSht1 & ":F" & LastRowSht1)
    Next Ctr
    
    End Sub
    I've attached my updated Macro sheet as well.
    Thank you for looking at this.
    Attached Files Attached Files
    Last edited by Hoosaskin; 09-14-2011 at 03:51 PM.

+ 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