Hi,
I have created commandbutton for my sales person to click at the end of each month to tell me that they are finished with their inputs. I am writing a macro to assign to the commandbutton.
My thought is to have a table where Column A is Jan 05, Feb 05, etc. and Column B is the date/time stamp. When the button is pushed, the current date and time will be assigned to the row for the month we are in. So, in March 2005, the sales person clicks the button, and cell in Column B next to the Mar-05 label in Column A receives the date/timestamp.
This is my first try at this macro. When I run this no matter if my computers date is set Jan or Feb, it posts dates into row 15 and row 16.
Anyideas?
Sub AESubmit()
'
Dim amtdate As Date
amtdate = Now()
'January Input
If amtdate >= 1 / 1 / 2005 And amtdate <= 1 / 31 / 2005 Then Worksheets("Sheet1").Activate
Worksheets("Sheet1").Cells(15, 2).Value = Now()
'February Input
If amtdate >= 2 / 1 / 2005 And amtdate <= 2 / 28 / 2005 Then Worksheets("Sheet1").Activate
Worksheets("Sheet1").Cells(16, 2).Value = Now()
End Sub
I'm sure there is a recursive way to do this, but I'm not smart enough to write it. Thanks for insights.
Thanks,
Terry
I have created commandbutton for my sales person to click at the end of each month to tell me that they are finished with their inputs. I am writing a macro to assign to the commandbutton.
My thought is to have a table where Column A is Jan 05, Feb 05, etc. and Column B is the date/time stamp. When the button is pushed, the current date and time will be assigned to the row for the month we are in. So, in March 2005, the sales person clicks the button, and cell in Column B next to the Mar-05 label in Column A receives the date/timestamp.
This is my first try at this macro. When I run this no matter if my computers date is set Jan or Feb, it posts dates into row 15 and row 16.
Anyideas?
Sub AESubmit()
'
Dim amtdate As Date
amtdate = Now()
'January Input
If amtdate >= 1 / 1 / 2005 And amtdate <= 1 / 31 / 2005 Then Worksheets("Sheet1").Activate
Worksheets("Sheet1").Cells(15, 2).Value = Now()
'February Input
If amtdate >= 2 / 1 / 2005 And amtdate <= 2 / 28 / 2005 Then Worksheets("Sheet1").Activate
Worksheets("Sheet1").Cells(16, 2).Value = Now()
End Sub
I'm sure there is a recursive way to do this, but I'm not smart enough to write it. Thanks for insights.
Thanks,
Terry