I need help with my macro. I've got a table of data A1:R35 in sheet "Active" and when the value in column R is 100% and you press this button I want it to copy and paste that whole row into the next available row in sheet "Completed".
Here is my current Macro:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim score As Integer
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Active")
Set pasteSheet = Worksheets("Completed")
score1 = Range("R1").Value
If score1 = 100% Then
copySheet.Range("A2:R2").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues, SkipBlanks:=False
Application.CutCopyMode = False
Application.ScreenUpdating = True
Sheets("Active").Range("A2:R2") = ""
score2 = Range("R2").Value
If score2 = 100% Then
copySheet.Range("A3:R3").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues, SkipBlanks:=False
Application.CutCopyMode = False
Application.ScreenUpdating = True
Sheets("Active").Range("A2:R2") = ""
*This repeated 35 times etc, their must be a better way and one that works?*
End If
End Sub
Is their a better way to do this that doesn't require 35 copies and this current If statement doesn't seem to work either
Any help would be much appreicated
Here is my current Macro:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim score As Integer
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Active")
Set pasteSheet = Worksheets("Completed")
score1 = Range("R1").Value
If score1 = 100% Then
copySheet.Range("A2:R2").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues, SkipBlanks:=False
Application.CutCopyMode = False
Application.ScreenUpdating = True
Sheets("Active").Range("A2:R2") = ""
score2 = Range("R2").Value
If score2 = 100% Then
copySheet.Range("A3:R3").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues, SkipBlanks:=False
Application.CutCopyMode = False
Application.ScreenUpdating = True
Sheets("Active").Range("A2:R2") = ""
*This repeated 35 times etc, their must be a better way and one that works?*
End If
End Sub
Is their a better way to do this that doesn't require 35 copies and this current If statement doesn't seem to work either
Any help would be much appreicated