1st of the month cell event--How to

KWFIELDS969

New Member
Joined
Mar 24, 2014
Messages
1
I am using excel to manage my spare parts inventory. I would like to copy one column to another on the fist of each month and then reset two columns to zero after the copy event. I have 4 columns that need work, 1. Monthly start qty 2. qty in stock 3. parts received 4. parts used. I need to have the numbers from the QTY in stock column to be copied to the Monthly start qty column on the first of every month. Then I need to reset the two remaining columns to a value of zero after the move is completed.
monthly startparts receivedparts usedqty in stock
40012399
2213

<tbody>
</tbody>
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
no blank rows, columns,cells. instead of blank enter 0

copy sheeet 1 to sheet 2 to preserve data for some time

now you have to run this macro

Code:
Sub test()
Dim r As Range, c As Range
Worksheets("sheet1").Activate
Set r = Range(Range("A2"), Range("A2").End(xlDown))
If Day(Date) = 1 Then
Range(Range("D2"), Range("d2").End(xlDown)).Copy Range("A2")
Range(Range("B2"), Range("D2").End(xlDown)).Cells.Clear
End If






End Sub
Code:
Sub undo()
Worksheets("sheet1").Cells.Clear
Worksheets("sheet2").Cells.Copy Worksheets("sheet1").Range("A1")
End Sub

today may not be the first so nothing will happen. if you want test modify
if day(date)=<todays date no. eg. 26> then
and then run the macro

now run undo macro
and change the above code to
If Day(Date) = 1 Then
 
Upvote 0

Forum statistics

Threads
1,216,140
Messages
6,129,105
Members
449,486
Latest member
malcolmlyle

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