spreadsheet.jpg
Hi, above is a short version of what my table looks like. I want a user to go in and enter Y or N if a task has been completed. If a y is entered, I then want the user to be able to click that button, which will take all rows that have a Y in the 'F' column and move it to a different spreadsheet. My current code is pasted below, but it's not working correctly. It is removing everything from the current spreadsheet over to the history sheet. (the code is not fully correct, I got it from a different forum and tried to add my own variables and column references but I was getting confused about what to change)
Private Sub UpdateHistory_Click()
Dim Current As Worksheet, History As Worksheet, Search As String
Dim Copy1 As Range
Set Current = Sheets("Current Maintenance(Melvindale)")
Set History = Sheets("History (Melvindale)")
Search = "y"
Current.Rows(1).Insert
Current.Range("a1:d1").Value = "header"
Current.Range("A1").AutoFilter field:=1, Criteria1:="*" & Search & "*"
Set Copy1 = Range(Current.Range("a2"), Current.Range("a2") _
.SpecialCells(xlCellTypeLastCell)).SpecialCells(xlCellTypeVisible)
Copy1.Copy History.Range("a1")
Copy1.EntireRow.Delete
Current.Range("A1").AutoFilter
Current.Rows(1).Delete
End Sub
Please Help! Thanks!
Bookmarks