M
matt3542
Dear Forum,
I am relatively new to VBA programming and as such would very much
appreciate any help with regards to writing VBA code that would allow me to
create a loop to compile a X (where x represents the number of columns
provided by a user via an inputbox) by Y (where y represents the number of
rows, again provided by an input box) size table with each cell having a
random value in it where the range of random numbers is between 1 and the
total number of cells. I have been tinkering with the notation -
ActiveCell.FormulaR1C1 = Int((TOTAL NUMBER OF CELLS * Rnd) + 1) but have not
managed to get it to work. Can anyone suggest a solution that uses the above
notation as I would like to understand more and have other areas of work that
I could apply its principles to.
Any help gratefully received
Regards
Matt
- Create a new workbook
- Setup an InputBox to ask the user for their required number of columns for
a table of data (x)
- Setup an InputBox to ask the user for their required number of rows for a
table of data (y)
- Setup a loop to compile a x by y size table with each cell having a random
value in it where the range of random numbers is between 1 and the total
number of cells (tip: ActiveCell.FormulaR1C1 = Int((TOTAL NUMBER OF CELLS *
Rnd) + 1)
I am relatively new to VBA programming and as such would very much
appreciate any help with regards to writing VBA code that would allow me to
create a loop to compile a X (where x represents the number of columns
provided by a user via an inputbox) by Y (where y represents the number of
rows, again provided by an input box) size table with each cell having a
random value in it where the range of random numbers is between 1 and the
total number of cells. I have been tinkering with the notation -
ActiveCell.FormulaR1C1 = Int((TOTAL NUMBER OF CELLS * Rnd) + 1) but have not
managed to get it to work. Can anyone suggest a solution that uses the above
notation as I would like to understand more and have other areas of work that
I could apply its principles to.
Any help gratefully received
Regards
Matt
- Create a new workbook
- Setup an InputBox to ask the user for their required number of columns for
a table of data (x)
- Setup an InputBox to ask the user for their required number of rows for a
table of data (y)
- Setup a loop to compile a x by y size table with each cell having a random
value in it where the range of random numbers is between 1 and the total
number of cells (tip: ActiveCell.FormulaR1C1 = Int((TOTAL NUMBER OF CELLS *
Rnd) + 1)