Random number assignment & auto date insertion

Tasha

New Member
Joined
Sep 15, 2002
Messages
2
I'm presently teaching a basic Excel course and one of my students requested a reply to this question. She works in a factory and must put out daily reports of all employees'production levels. Her specific inquiry was: "How do I have Excel automatically print the date without user intervention and how can I assign a list of chronological numbers to each production sheet similar to an invoice number without user intervention?"
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

PaddyD

MrExcel MVP
Joined
May 1, 2002
Messages
14,234
On 2002-09-16 19:49, Tasha wrote:
I'm presently teaching a basic Excel course and one of my students requested a reply to this question. She works in a factory and must put out daily reports of all employees'production levels. Her specific inquiry was: "How do I have Excel automatically print the date without user intervention and how can I assign a list of chronological numbers to each production sheet similar to an invoice number without user intervention?"

Hi Tasha - welcome to the board!

Not quite sure where to start here - there's a risk of teaching granny to suck eggs etc...

Re the 'print today's date' issue - depends what you want to do. =today() in a cell will automatically update in line with the computer's clock. Is this too simple minded?

Re the 'auto update number' issue - one way would be to have a macro that ran each time the workbook opened & added 1 to the number in a cell. Again, the details would depend on what was trying to be achieved.

post back if this is way off the mark (or even if it isn't!)

Paddy
 

Tasha

New Member
Joined
Sep 15, 2002
Messages
2
Thnx Paddy,
Where could I get the code for such a macro to increment a number by one digit? I'm a little green but I'm willing to learn.
 

PaddyD

MrExcel MVP
Joined
May 1, 2002
Messages
14,234
On 2002-09-16 20:23, Tasha wrote:
Thnx Paddy,
Where could I get the code for such a macro to increment a number by one digit? I'm a little green but I'm willing to learn.


1) Open a new workbook
2) Press Alt + F11 to open te VBA editor
3) Double click on the 'ThisWorkbook' entry on the left.
4) Paste this code into the window on the right:

Code:
Private Sub Workbook_Open()
'
Range("sheet1!a1").Value = Range("sheet1!a1").Value + 1
End Sub

5) Close the editor & the workbook, saving as you go.
6) Open the workbook - check out a1 on sheet1. Save, close & do it again...

Paddy
 

Forum statistics

Threads
1,144,354
Messages
5,723,884
Members
422,524
Latest member
wirkkarn

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
Top