Philip1957
Board Regular
- Joined
- Sep 30, 2014
- Messages
- 185
- Office Version
- 365
- Platform
- Windows
Greetings,
I have a Workbook for tracking change orders. When an ECO is closed, I select any cell in the row and run the following to erase the data and clear the formatting on that row.
This works just fine.
I will be out of the office for an extended period of time and a colleague will be covering this for me. On my return, I will need to review some of the ECOs (indicated by an x in column O) that closed during my absence. I am trying to modify my macro above so that it will conditionally copy the active row from WS "Tracking" if there is an X in column O and paste it to WS "Archive", then return to "Tracking" to clear the data and formatting. This way I'll have a list of the relevant closed change orders when I get back.
I have been playing around with variations on the following with no luck at all. I can't even seem to get it to find the X in column O, which is frustrating because it seems like it should be easy.
Any assistance with this would be greatly appreciated.
Thanks,
~ Phil
I have a Workbook for tracking change orders. When an ECO is closed, I select any cell in the row and run the following to erase the data and clear the formatting on that row.
Code:
Sub Clear_ECO()
MSG1 = MsgBox("This action cannot be undone!" & vbCrLf & vbCrLf & "Selected Row is: " & ActiveCell.Row, 1, "CAUTION!")
Application.ScreenUpdating = False
If MSG1 = vbOK Then
'Select row
ActiveCell.EntireRow.Select
'Return to Blank Format
Selection.Interior.Color = xlNone
Selection.Font.Strikethrough = False
Selection.Font.ColorIndex = 0
Selection.ClearContents
End If
Application.ScreenUpdating = True
End Sub
This works just fine.
I will be out of the office for an extended period of time and a colleague will be covering this for me. On my return, I will need to review some of the ECOs (indicated by an x in column O) that closed during my absence. I am trying to modify my macro above so that it will conditionally copy the active row from WS "Tracking" if there is an X in column O and paste it to WS "Archive", then return to "Tracking" to clear the data and formatting. This way I'll have a list of the relevant closed change orders when I get back.
I have been playing around with variations on the following with no luck at all. I can't even seem to get it to find the X in column O, which is frustrating because it seems like it should be easy.
Code:
Sub New_Clear()
Dim Rtn As Range
MSG1 = MsgBox("This action cannot be undone!" & vbCrLf & vbCrLf & "Selected Row is: " & ActiveCell.Row, 1, "CAUTION!")
Application.ScreenUpdating = False
If MSG1 = vbOK Then
'Select row
ActiveCell.EntireRow.Select
Set Rtn = ActiveRow
'Copy Record of Closed ECO with Documents to Archive tab
If ActiveRow.Range("O").Value = "X" Then
ActiveRow.Copy Sheets("Archive").Range("A" & Rows.Count).End(xlUp).Offset(1).Paste
End If
'Return to Blank Format
Sheets("Tracking").Rtn.Select
Selection.Interior.Color = xlNone
Selection.Font.Strikethrough = False
Selection.Font.ColorIndex = 0
Selection.ClearContents
Application.ScreenUpdating = True
End Sub
Any assistance with this would be greatly appreciated.
Thanks,
~ Phil