• Change Macro to Allow for User Variables

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Change Macro to Allow for User Variables

    Author
    Topic
    #2396982

    I found this macro online (from 10 years ago) that solved a problem I was having in regards to sorting golfers into random teams where no one plays with the same person over four days. Each digit in the 4 digit number this macro returns is a unique player, so for example 1234 would refer to first golfer from Group A, 2 would refer to second golfer from Group B etc. This macro is meant for 24 golfer (A1 to A6, B1 to B6, C1 to C6 and D1 to D6) over four days of golf.

    I am hoping someone could help me, I would like to be able to change the macro so instead of it being for 24 golfers over four days the macro would look for the number entered, for example, in Sheet 1, cell A1 to get the number of golfers (always multiples of 4) and get the number of rounds from Sheet 1, cell A2 (three to eight rounds).

    Basically I want this macro to to perform the same function, but allow me to enter a couple of variables.

    Any help would be appreciated.

    Moderator edit:
    Code including a lot of HTML removed.
    Please re-post by pasting into TEXT tab.

    • This topic was modified 3 years, 6 months ago by b.
    • This topic was modified 3 years, 6 months ago by b.
    Viewing 0 reply threads
    Author
    Replies
    • #2397022

      Hello, this is very interesting and I would like to participate, but sadly I have not enought time to create it right now.

      https://excelchamps.com/vba/random-number/
      Maybe this could help.

      In the VBA, change the constant numbers you want to change. Instead of the constant put
      Cells(1, 1).Value or possibly Int(Cells(1, 1).Value)
      in the formula, so you can change the numbers dynamically by entering into A1 cell.

      Is it possible to post the code here? Maybe it will be much faster to give you right directions. I dont know, how advanced programmer you are.

      Dell Latitude 3420, Intel Core i7 @ 2.8 GHz, 16GB RAM, W10 22H2 Enterprise

      HAL3000, AMD Athlon 200GE @ 3,4 GHz, 8GB RAM, Fedora 29

      PRUSA i3 MK3S+

    Viewing 0 reply threads
    Reply To: Change Macro to Allow for User Variables

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: