+ Reply to Thread
Results 1 to 6 of 6

fill any 6 of 18 cells randomly with an "X"

  1. #1
    Registered User
    Join Date
    11-07-2011
    Location
    Wisconsin USA
    MS-Off Ver
    Excel 2016
    Posts
    18

    fill any 6 of 18 cells randomly with an "X"

    I need a macro that will do exactly as the title says. I have 18 cells that, when a command button is pressed, it will randomly pick 6 of the 18 cells and fill them with an x. Is this even possible?

  2. #2
    Registered User
    Join Date
    08-26-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: fill any 6 of 18 cells randomly with an "X"

    can use the below


    Please Login or Register  to view this content.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: fill any 6 of 18 cells randomly with an "X"

    Another way:
    Please Login or Register  to view this content.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: fill any 6 of 18 cells randomly with an "X"

    Hi, MyComputerGuy,

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    http://www.ozgrid.com/forum/showthread.php?t=181208

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: fill any 6 of 18 cells randomly with an "X"

    Above solution is not good.
    It return wrong result on large number of results.

    Here is distribution of previous solution:
    Please Login or Register  to view this content.
    And this is new solution:
    Please Login or Register  to view this content.
    Looks like RANDEBETWEEN function doesn0t work fine

    Code is below

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: fill any 6 of 18 cells randomly with an "X"

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Auto Fill Blank Cells - Using Differing "Start" Numbers
    By HowD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2013, 01:05 PM
  2. [SOLVED] Manually fill up 1 or (some) cells with just "BFW"or"BF" in data validation
    By robke1960 in forum Non English Excel
    Replies: 2
    Last Post: 12-11-2012, 11:31 AM
  3. VBA. Fill empty cells with text "OPEN", I2 downwards, row count Col A
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2011, 06:50 PM
  4. Replies: 5
    Last Post: 06-12-2008, 12:39 PM
  5. [SOLVED] How to fill in "BLANK" Cells Automactically...Large Spread Sheet
    By msbutton27 in forum Excel General
    Replies: 3
    Last Post: 01-15-2006, 12:15 PM

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