Closed Thread
Results 1 to 4 of 4

Randomized Room

  1. #1
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,736

    Randomized Room

    Hello

    I wanted Sheet1 to work like Sheet2.
    I created Sheet1 which I added columns for dates. My range for randomized is in B8:B35 and E8:E35. But when I transferred or copied the code from Module1 to Module2 Then I did not work.

    Can you please modify the code in Module2. See attachment worksheet.

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Randomized Room

    Use this:

    PHP Code: 
    Sub pick_Random1()
    Dim k&, rd(1 To 100001 To 1)
    Dim cell As Range
    For Each cell In Range("K8:K" Cells(Rows.Count"K").End(xlUp).Row' from K8 to last used cell in col K
        If Not IsEmpty(cell) Then
            k = k + 1
            rd(k, 1) = cell.Value
        End If
    Next
    Randomize
    For Each cell In Range("B8:E35")
        If cell.Column = 2 Or cell.Column = 5 Then
            cell.Value = rd(Int(Rnd * k + 1), 1)
        End If
    Next
    Range("B1").Select
    End Sub 
    Attached Files Attached Files
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,736

    Re: Randomized Room

    Hi
    Ok.. Thank you bebo.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,730

    Re: Randomized Room

    Administrative Note:

    Unfortunately, this is a duplicate thread, and you are allowed only ONE thread per issue here.

    Please see Forum Rule #2 about thread duplication.

    I am closing this thread, but you may continue here in the original thread: https://www.excelforum.com/excel-pro...dom-rooms.html

    Thread closed.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Randomized with the special room
    By RJ1969 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2023, 02:48 PM
  2. randomized
    By RJ1969 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2022, 04:25 PM
  3. [SOLVED] Randomized Questions with Correlating Randomized Answers
    By rgiere in forum Excel General
    Replies: 3
    Last Post: 11-19-2020, 11:07 AM
  4. [SOLVED] If date matches and room matches, return room info in to cell
    By HonorBray in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-12-2018, 12:09 PM
  5. [SOLVED] How to Calculate Hotel room nights booked, for each night, and broken down by room type?
    By salsadantzr in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-09-2018, 04:53 PM
  6. Room Allotment:remove allotted room from dropdown list
    By amdrosm in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-05-2017, 04:50 AM
  7. Converting tabular data into room-by-room
    By tomca in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-03-2016, 07:00 AM

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