Hi all,
I am a completely new user to Excel Macros!
I have sourced myself a code from this site, that goes a little something like:
I can't seem to get the desired result however, and I suspect it is because I am not fulfilling the requirements for the "MoveDay" variables.
For context, I am trying to create an automated function that will check all dates for some staff training inputs, and if the date exceeds a certain paramater, will move the data to another area. (At the moment the code specifies it wants it to be moved from C2 to E2 but I am wondering if this can be expanded to move to a different Worksheet, and if I can get it to move more than the single cell?
Thanks!
Your friendly Internet Simple_DirectorateAdminSupport
I am a completely new user to Excel Macros!
I have sourced myself a code from this site, that goes a little something like:
VBA Code:
Private Sub Worksheet_Activate()
Dim LookupRange As Range
Dim MoveToRange As Range
Dim MoveDay As Long
Dim ClearRow As Range
Set LookupRange = Worksheets("Sheet1").Range("C2")
Set MoveToRange = Worksheets("Sheet1").Range("E2")
MoveDay = Day(Now)
If MoveDay = Day(Today) - 365 Then
If MsgBox("Data will be moved today as some training has been recorded for over a year.**Do you wish to move the data?", vbYesNo + vbQuestion, "Move Data") = vbYes Then
MoveToRange.Value = LookupRange.Value
LookupRange.Value = ""
ClearRow.Value = ""
End If
End If
End Sub
I can't seem to get the desired result however, and I suspect it is because I am not fulfilling the requirements for the "MoveDay" variables.
For context, I am trying to create an automated function that will check all dates for some staff training inputs, and if the date exceeds a certain paramater, will move the data to another area. (At the moment the code specifies it wants it to be moved from C2 to E2 but I am wondering if this can be expanded to move to a different Worksheet, and if I can get it to move more than the single cell?
Thanks!
Your friendly Internet Simple_DirectorateAdminSupport