Results 1 to 6 of 6

VBA to Archive lines of data when work is complete

Threaded View

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    danbury, ct
    MS-Off Ver
    Excel 2010
    Posts
    4

    VBA to Archive lines of data when work is complete

    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
    Last edited by sailadayaway; 08-14-2014 at 07:56 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Repeating macro for various worksheets to complete lines in consolidation sheet
    By RossChip in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2013, 07:46 AM
  2. Help with VBA to auto archive data
    By Kayaness in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-05-2012, 01:43 AM
  3. Replies: 5
    Last Post: 10-18-2010, 08:53 AM
  4. Replies: 4
    Last Post: 09-08-2010, 11:17 AM
  5. how do i sort a complete work sheet in excel
    By Jerry in forum Excel General
    Replies: 2
    Last Post: 04-26-2006, 08:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1