Hey Everyone,
I am trying to create Minesweeper in excel (to increase office productivity). I am already pretty good with VBA so creating it in a worksheet would be a cakewalk for me, so I am trying to create it in a user form.I also want to learn how to get better with class modules, which explains my approach. see below:
i have already created a user form to start the game ( select difficulty, or enter custom parameters for rows, cols and # of mines)
this user form takes the inputs and creates an array containing the mines and the number of mines adjacent to any given square.
the start game user form calls another userform containing the game itself. i used 2 for loops to create commandbuttons for each cell of the minesweeper field.
my issue is in adding code to each of the command buttons. everything I found on adding the code to each button using a class module is instructions to create a general purpose class module for handling all your events. i wanted to make a class module for just this button and it could also contain info like whether it has a mine, a flag, or has been clicked already.
Am i approaching this from the wrong direction. i was thinking maybe i should create a class module for the whole minefield tha contians multiple buttons, would that work?
I am trying to create Minesweeper in excel (to increase office productivity). I am already pretty good with VBA so creating it in a worksheet would be a cakewalk for me, so I am trying to create it in a user form.I also want to learn how to get better with class modules, which explains my approach. see below:
i have already created a user form to start the game ( select difficulty, or enter custom parameters for rows, cols and # of mines)
this user form takes the inputs and creates an array containing the mines and the number of mines adjacent to any given square.
the start game user form calls another userform containing the game itself. i used 2 for loops to create commandbuttons for each cell of the minesweeper field.
my issue is in adding code to each of the command buttons. everything I found on adding the code to each button using a class module is instructions to create a general purpose class module for handling all your events. i wanted to make a class module for just this button and it could also contain info like whether it has a mine, a flag, or has been clicked already.
Am i approaching this from the wrong direction. i was thinking maybe i should create a class module for the whole minefield tha contians multiple buttons, would that work?