• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Select and move row(s) from one sheet to another with button

JillStraton

New Member
Hello All,

I'm going crazy! I want my user to select row(s) from the quotelog sheet then hit a button to move it to another sheet called Archive. HELP. See what I have already. I put in a column where they can put in an x then button cuts and moves. But not working. HELP HELP

THANK YOU THANK YOU in advance
Jill
 

Attachments

Change your Move macro to this:
Code:
Sub Move()
Dim markedCells As Range
Dim c As Range

Application.ScreenUpdating = False
'Since you have event macros, we'll turn this off temporaily
Application.EnableEvents = False

'Which cells have been marked?
On Error Resume Next
Set markedCells = Range("A:A").SpecialCells(xlCellTypeConstants)
On Error GoTo 0

'Error check
If markedCells Is Nothing Then
    MsgBox "Please place a mark in col A next to rows you want to archive"
    Exit Sub
End If

'Clear marks
Range("A:A").ClearContents
With Worksheets("Archive")
    For Each c In markedCells
        'Copy line to next blank line in archive
        c.EntireRow.Copy .Cells(.Cells(.Rows.Count, "B").End(xlUp).Row + 1, 1)
    Next c
End With
'Remove original line
markedCells.EntireRow.Delete

Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
 
Back
Top