T
TimN
I have the following code which makes a copy of a portion of my spreadsheet
at the "OK" command event and saves to the next available cell in the Data
worksheet.
Private Sub cmdOK_Click()
Dim rCell As Range
With Application.ThisWorkbook
Set rCell = .Worksheets("Data").Range("A65536").End(xlUp).Offset(1, 0)
Worksheets("STD Calc").Range("B14:N33").Copy
rCell.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End With
Unload Me
End Sub
Prior to the OK button being clicked, the user has entered via a user form,
a beginning date for a two week payroll period. That date range and
coresponding data is then copied with the code above.
What I need to add in is a way to check for an occurance where the user
enters a date that already exists on the Data worksheet and the new copy is
saved right over the top of the old data that coresponds to that same date
range. This will happen if an error is made for a payroll period and the
user needs to correct it by going back to that payroll period. In other
words, I don't want to save the corrections to the next empty cell, I want it
to copy over the original data which was entered incorrectly and is now being
corrected.
How can I do that?
Thanks for any ideas.
at the "OK" command event and saves to the next available cell in the Data
worksheet.
Private Sub cmdOK_Click()
Dim rCell As Range
With Application.ThisWorkbook
Set rCell = .Worksheets("Data").Range("A65536").End(xlUp).Offset(1, 0)
Worksheets("STD Calc").Range("B14:N33").Copy
rCell.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
End With
Unload Me
End Sub
Prior to the OK button being clicked, the user has entered via a user form,
a beginning date for a two week payroll period. That date range and
coresponding data is then copied with the code above.
What I need to add in is a way to check for an occurance where the user
enters a date that already exists on the Data worksheet and the new copy is
saved right over the top of the old data that coresponds to that same date
range. This will happen if an error is made for a payroll period and the
user needs to correct it by going back to that payroll period. In other
words, I don't want to save the corrections to the next empty cell, I want it
to copy over the original data which was entered incorrectly and is now being
corrected.
How can I do that?
Thanks for any ideas.