View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
matt3542 matt3542 is offline
external usenet poster
 
Posts: 60
Default Creating a table based on user input

Hi Forum,

As always I would be very grateful if anyone can help with writing some
Excel VBA code that would allow me to complete the following task;

I have 2 input boxes that prompt the user to specify the value of two
variables (x = the required number of columns & y = the required number of
rows for a table of data. I would then like to create 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. I am really new to
VBA but have been told the code would involve the statement
ActiveCell.FormulaR1C1 = Int((TOTAL NUMBER OF CELLS * Rnd) + 1) but I am
struggling to make it work. I'd be really appreciative if anyone is willing
to take the time to help with the code for this loop.

Best wishes
Matt