+ Reply to Thread
Results 1 to 15 of 15

Generate 9 random playing cards from a set of given pictures

  1. #1
    Registered User
    Join Date
    05-13-2021
    Location
    spain
    MS-Off Ver
    office 365 32 bit
    Posts
    13

    Talking Generate 9 random playing cards from a set of given pictures

    Good day, Folks. Thank you for letting me join. I am a complete novice with Excel hence my need for your wisdom and knowledge.

    I'm TRYING to create a game whereby I can generate printouts showing nine playing cards radomly selected. It's a game called 'Hoy' here in spain along the lines of bingo. once each player has a sheet I select cards from a shuffled deck of cards and once they cover all their cards with tokens they call Hoy! and win.

    Ok, i've managed to download all 52 cards as jpegs and placed each one inside a cell. A1-A52 that's it!

    I now need to create a 9x9 cell grid within the worksheet whereby with some click of a button 9 random cards appear in the grid which I can print off.

    I hope i've explained it clearly enough. I imagine it's not as simple as first seems.

    Any clues to as what I need to do, process, example would be gratefully recieved as hopefully family and friends can shortly visit us.

    I could buy numerous decks of cards and stick 9 onto a sheet should this be too complicated for me to do but hoped printed looked more professional and i like a challenge.

    Thank you in advance.
    Attached Images Attached Images
    Last edited by Richard Buttrey; 05-13-2021 at 06:32 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Thank you and help!

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.
    Your title should be explicit and not general in nature

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    Since this is your first post I'll change it for you, however note for the future.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Generate 9 random playing cards from a set of given pictures

    Would you upload a copy of your workbook. We don't need all 52 rows and pictures of cards, just half a dozen will suffice for developing a solution which will probably involve a simple macro.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,811

    Re: Generate 9 random playing cards from a set of given pictures

    Here is a BINGO version that you may be able to adapt to your needs. In this case, it uses US State Names.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    05-13-2021
    Location
    spain
    MS-Off Ver
    office 365 32 bit
    Posts
    13

    Re: Generate 9 random playing cards from a set of given pictures

    Thank you ever so much with your prompt response. i've managed randomnising numbers associated witht the pictures but don't know how to connect the number and image to get random images. this example is much appreciated but works with numbers and words. I need images to be randomised. I'll upload what I have so far. Thanks again.

  6. #6
    Registered User
    Join Date
    05-13-2021
    Location
    spain
    MS-Off Ver
    office 365 32 bit
    Posts
    13

    Talking Re: Generate 9 random playing cards from a set of given pictures

    Here's the workbook. thank you.
    Attached Files Attached Files

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,811

    Re: Generate 9 random playing cards from a set of given pictures

    perhaps instead of a picture/image, you use the name of the card, ie. Queeen of Hearts, King of Clubs, etc.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Generate 9 random playing cards from a set of given pictures

    See how you get on with this.

    You'll need to copy the macro into your production workbook. See attached

    In essence the macro counts all the cards on sheet1 and fills a VBA array of all the card indices with an "x" to indicate the card is available
    A loop then picks out 9 cards and check when it's picking them that it's not already been used. If it has it removes the "x" from the VBa array for that card.


    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-13-2021
    Location
    spain
    MS-Off Ver
    office 365 32 bit
    Posts
    13
    Wow! That looks crazy complex. Glad I sourced you guys as thought it was relatively straight forward. Will try it when I get home from work. Must admit quite excited to see if it works. Thanks you for your time as I imagine it took some doing. Will let you know how it goes. Have a great day. 😁😁😁

    Quote Originally Posted by Richard Buttrey View Post
    See how you get on with this.

    You'll need to copy the macro into your production workbook. See attached

    In essence the macro counts all the cards on sheet1 and fills a VBA array of all the card indices with an "x" to indicate the card is available
    A loop then picks out 9 cards and check when it's picking them that it's not already been used. If it has it removes the "x" from the VBa array for that card.


    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-13-2021
    Location
    spain
    MS-Off Ver
    office 365 32 bit
    Posts
    13
    That would be too easy! But I won't dismiss it should all other options fail but would be easier for participants to visualise card rather than eight of clubs etc.Thank you.

    Quote Originally Posted by alansidman View Post
    perhaps instead of a picture/image, you use the name of the card, ie. Queeen of Hearts, King of Clubs, etc.

  11. #11
    Registered User
    Join Date
    05-13-2021
    Location
    spain
    MS-Off Ver
    office 365 32 bit
    Posts
    13
    Thank you again. I might be thick but how do I get it to do anything? I downloaded your workbook version and ran the macro thing but nothings happened. It looks the part as requested but macros are beyond me by a mile and I'm a novice excel user. Could a button be added I just push and it creates a new 9 cell display? Sorry for my simplicity.




    Quote Originally Posted by Spaggoni View Post
    Wow! That looks crazy complex. Glad I sourced you guys as thought it was relatively straight forward. Will try it when I get home from work. Must admit quite excited to see if it works. Thanks you for your time as I imagine it took some doing. Will let you know how it goes. Have a great day. 😁😁😁

  12. #12
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Generate 9 random playing cards from a set of given pictures

    See attached.

    I've added a 'Clear' button just so that you can see the other button does refresh cards. The Clear buttin isn;t necessary since the other macro performs a clear before adding a new set of cards.

    The easiest way of adapting this to your production workbook that contains all 52 cards would be to copy the Playing Cards sheet into the workbook attached, and then change the VBA sheet name to 'Sheet1'. Copying it in will have created a new VBA sheet name of 'Sheet3" so it will need changing.

    Alternatively you could change the three references to the Sheet1 VBA code names in the macro as follows

    Sheet1.Shapes(lcard).Copy

    Change to

    Sheets("Playing Cards").Shapes(lcard).Copy

    and make sure you change current Tab name from "Playing Cards" to say "Old_"Playing Cards", and "Playing Cards(1)" back to "Playing Cards"
    Then you can delete the Old_Playing Cards sheet
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    05-13-2021
    Location
    spain
    MS-Off Ver
    office 365 32 bit
    Posts
    13
    That's awesome thanks very much indeed. I worked out how to expand for 52 cards and actually managed to run the macro. I am extremely grateful for all your help. There wasn't a hell in chance of doing it myself. 👍👍👍👍

    Quote Originally Posted by Richard Buttrey View Post
    See attached.

    I've added a 'Clear' button just so that you can see the other button does refresh cards. The Clear buttin isn;t necessary since the other macro performs a clear before adding a new set of cards.

    The easiest way of adapting this to your production workbook that contains all 52 cards would be to copy the Playing Cards sheet into the workbook attached, and then change the VBA sheet name to 'Sheet1'. Copying it in will have created a new VBA sheet name of 'Sheet3" so it will need changing.

    Alternatively you could change the three references to the Sheet1 VBA code names in the macro as follows

    Sheet1.Shapes(lcard).Copy

    Change to

    Sheets("Playing Cards").Shapes(lcard).Copy

    and make sure you change current Tab name from "Playing Cards" to say "Old_"Playing Cards", and "Playing Cards(1)" back to "Playing Cards"
    Then you can delete the Old_Playing Cards sheet

  14. #14
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,811

    Re: Generate 9 random playing cards from a set of given pictures

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  15. #15
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,295

    Re: Generate 9 random playing cards from a set of given pictures

    Alternative - nothing on any sheets - all contained in one UserForm.
    torachan.
    Attached Files Attached Files

+ 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