WishfulExcelWizard
New Member
- Joined
- Feb 19, 2024
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Hello
I am trying to write a VBA formula to automatically copy one row from one tab to another tab within the same workbook based on a criteria of "completed" identified in a drop down. Below is the code I found online and keep received out of range error message. I am very new to this and trying to find some help! Thank you
Dim StageColAs Range
Dim Stage As Range
Dim PasteCell As Range
Set StageCol = Sheet1.Range("M2:M14")
For Each Stage in StageCol
If Sheet2.Rnage("A2") = "" Then
Set PasteCell = Sheet2.Rnage("A2')
Else
Set PasteCell = Sheet2.Range ("A1").End(x1Down).Offset(1, 0)
End If
If Stage = "Completed"" Then Stage.EntireRow.Copy PasteCell
Next Stage
End Sub
I am trying to write a VBA formula to automatically copy one row from one tab to another tab within the same workbook based on a criteria of "completed" identified in a drop down. Below is the code I found online and keep received out of range error message. I am very new to this and trying to find some help! Thank you
Dim StageColAs Range
Dim Stage As Range
Dim PasteCell As Range
Set StageCol = Sheet1.Range("M2:M14")
For Each Stage in StageCol
If Sheet2.Rnage("A2") = "" Then
Set PasteCell = Sheet2.Rnage("A2')
Else
Set PasteCell = Sheet2.Range ("A1").End(x1Down).Offset(1, 0)
End If
If Stage = "Completed"" Then Stage.EntireRow.Copy PasteCell
Next Stage
End Sub