Hi there, I have a status board that I'm trying to set up an automatic archive feature that takes a row of data and drops it into a separate archive sheet. I've gotten the code to move the data how I want, but now I need the rest of the data on the page to shift up and fill in the space.
I have one easy problem, which is I only want it to clear the contents in that row from Column A to T (Beyond column T I have a number of formulas that run metrics in the Archive sheet.)
And I have one not so easy problem. I need the rest of the data in columns A to T to shift up, but I can't just use .delete because I have other pages that reference the cells from this page. When I try .delete, it breaks the references in the other pages and messes up the display page. Here is the code I have so far:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim arbox As String
With Target
On Error Resume Next
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range("p2:p126"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 2).ClearContents
Else
With .Offset(0, 2)
.NumberFormat = "mm/dd/yy"
.Value = Date
End With
arbox = MsgBox("This Job is complete will now be archived. Click OK to continue or cancel if you made a mistake", vbOKCancel, "Archive?")
If arbox = 1 Then
With .EntireRow
.Copy Destination:=Sheets("ARCHIVE") _
.Range("A" & Rows.Count).End(xlUp).Offset(1)
.ClearContents 'I need this line to only clear columns A to T of the row
'select rest of data from column A to T and shift up
End With
Else
arbox = MsgBox("Please delete 'x' from last sequence", vbOKOnly)
End If
End If
Application.EnableEvents = True
End If
End With
End Sub
Bookmarks