Results 1 to 14 of 14

Random Rooms

Threaded View

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

    Random Rooms

    Hello

    I am stock. Help.

    I added a columns for dates and when I click the button it stop working the button for reset.

    My original worksheet was in Sheet2 and the vba code was working for it.
    I left the original code but I don't know which one that I need to change so that it will work for the random in column for Room which B8:E35 which used to be A8:C35.

    Thank you in advance

    See attachment.

    Sub pick_Random()
    
    Sheets("Random Matrix").Unprotect "RD"    '<----- Change as required
    
    Dim i&, j&, k&, rng, rd(1 To 10000, 1 To 1)
    Dim cell As Range
    For Each cell In Range("I8:I20") ' change to actual range of random numbers
        If Not IsEmpty(cell) Then
            k = k + 1
            rd(k, 1) = cell.Value
        End If
    Next
    rng = Range("A8:C35").Value
    Randomize
    For i = 1 To UBound(rng)
        For j = 1 To 3
            If j <> 2 Then rng(i, j) = rd(Int(Rnd * k) + 1, 1)
        Next
    Next
    Range("A8:C35").Value = rng
    
    'add this for the allow users of this worksheet to: Format cells and Sort
    With Sheets("Random Matrix") 'change it here
        .Protect _
            Password:="RD", _
            DrawingObjects:=True, _
            Contents:=True, _
            Scenarios:=True, _
            AllowFormattingCells:=True, _
            AllowSorting:=True
        .EnableSelection = xlUnlockedCells
    End With
    
    Range("B1").Select
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Address location of rooms
    By marjovdn in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 08-10-2022, 11:09 PM
  2. [SOLVED] Formula to alternate two values between rooms
    By Ricker090 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-11-2017, 06:11 PM
  3. [SOLVED] Are there excel chat rooms
    By Wally Steadman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-20-2016, 04:50 PM
  4. Choosing Rooms
    By realvirtuality1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-18-2014, 05:20 PM
  5. [SOLVED] Search for free rooms
    By Berna11 in forum Excel General
    Replies: 4
    Last Post: 02-16-2014, 05:33 AM
  6. Percentage Formula for rooms completed
    By tf4string in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-19-2013, 07:38 PM
  7. [SOLVED] rooms checklist
    By hany elkader in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-25-2006, 01:15 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