The following code module has an odd problem (sorry, line wrapping is lousy): the last line attempts to write a value (in this case, a date) to a cell, which generates an "Application-defined or object-defined error". I can read the value from the cell, and I can verify the value I want to write to the cell. The code executes properly up to the Stop command. The problem line works correctly if I move it to another module. I have tried writing a different variable value, writing a constant (i.e. "1"
, writing to a different cell, all to no avail.
Some other line in the code must be causing this - any ideas what is wrong? support.Microsoft.com doesn't seem to have the answer either.
Thanks!
VBAjedi
Sub RotateMonths()
'
' RotateMonths Macro
' Macro recorded 12/18/02 by Obie PC Support
'
Dim ConfirmAction As Integer
Dim FirstPeriodDate As Date
Dim x
Sheets("AvailabilityTracker"
.Activate
ConfirmAction = MsgBox("Warning: This will clear the projected sales " _
& "data for " & Range("S3"
.Value & ". This action cannot " _
& "be undone. Proceed?", vbOKCancel)
If ConfirmAction = 2 Then End ' user clicked "Cancel" button.
Range("A6"
.AutoFilter ' Turns off AutoFilter and displays all
FirstPeriodDate = Range("S3"
.Value
Range("W6
R10000"
.Select
Selection.Copy
'Range("S
Q"
.MergeCells = False
Range("S6
N10000"
.Select ' DK or DN?
ActiveSheet.Paste
Range("DR6
R10000"
.Clear
Range("S3"
.Select
Range("A6"
.AutoFilter Field:=1 ' Turns AutoFilter back on
FirstPeriodDate = (FirstPeriodDate + 28)
Stop
Sheets("AvailabilityTracker"
.Range("S3"
.Value = FirstPeriodDate
End Sub
Some other line in the code must be causing this - any ideas what is wrong? support.Microsoft.com doesn't seem to have the answer either.
Thanks!
VBAjedi
Sub RotateMonths()
'
' RotateMonths Macro
' Macro recorded 12/18/02 by Obie PC Support
'
Dim ConfirmAction As Integer
Dim FirstPeriodDate As Date
Dim x
Sheets("AvailabilityTracker"
ConfirmAction = MsgBox("Warning: This will clear the projected sales " _
& "data for " & Range("S3"
& "be undone. Proceed?", vbOKCancel)
If ConfirmAction = 2 Then End ' user clicked "Cancel" button.
Range("A6"
FirstPeriodDate = Range("S3"
Range("W6
Selection.Copy
'Range("S
Range("S6
ActiveSheet.Paste
Range("DR6
Range("S3"
Range("A6"
FirstPeriodDate = (FirstPeriodDate + 28)
Stop
Sheets("AvailabilityTracker"
End Sub