How to Log Inputs - Can it Be Done?

Jared 4

New Member
Joined
Sep 7, 2005
Messages
35
Hi... I have a random number in a cell... everytime I generate a new random number in that cell, I want it to be recorded in a column...so by the time I have generated six random numbers, the column will be six rows deep.

Can this be done?

Thanks!!!!
Jared
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Here is something I came up with. You'll have to adjust the code to work with your existing macro as well as have it dump the random numbers into the column of your choice (I would set the start cell in the beginning of the macro)

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> Test()
<SPAN style="color:#00007F">Dim</SPAN> Start <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>

<SPAN style="color:#00007F">If</SPAN> ActiveCell.Row = 1 <SPAN style="color:#00007F">Then</SPAN>
    ActiveCell.Offset(1, 0).Select
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>

Start = ActiveCell.Row

<SPAN style="color:#00007F">Do</SPAN> <SPAN style="color:#00007F">Until</SPAN> ActiveCell.Row - Start = 5

ReRun:
<SPAN style="color:#00007F">If</SPAN> ActiveCell.Value = "" <SPAN style="color:#00007F">Then</SPAN>
    ActiveCell.Value = ActiveCell.Offset(-1).Value + 1
<SPAN style="color:#00007F">ElseIf</SPAN> <SPAN style="color:#00007F">Not</SPAN> ActiveCell.Value = "" <SPAN style="color:#00007F">Then</SPAN>
    ActiveCell.Offset(1, 0).Select
<SPAN style="color:#00007F">GoTo</SPAN> ReRun
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>

<SPAN style="color:#00007F">Loop</SPAN>

<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

I'm sure someone else will come up with a more efficient way to do the same thing... this is to get you started.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top