Danielle123
New Member
- Joined
- May 4, 2018
- Messages
- 7
Hi All,
I have a workbook consisting of 6 worksheets (all with data referring to that location). I have a macro in place to loop through all the worksheets and look for the projects that are "closed" , it then cuts the rows based on the condition and transfers it to a worksheet called closed.
I'm wondering if there's a way of sending that row from the closed worksheet back to the sheet it came from if i changed the condition from = " closed to active "
I've searched site wide and cant find anything relating to it so any help would be greatly appreciated. Below is a sample of my macro i have in place at present.
Thank you
Sub LoopThroughSheets()
Application.ScreenUpdating = False
Dim Ws As Worksheet
For Each Ws In ActiveWorkbook.Worksheets
Dim i As Integer
Dim lRow As Long
lRow = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lRow
If Cells(i, 14).Value = "Closed" And Cells(i, 15).Value = "Closed" Then
Range(Cells(i, 1), Cells(i, 24)).Copy Sheets("Closed").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Range(Cells(i, 1), Cells(i, 24)).ClearContents
End If
Next
Columns("A").SpecialCells(4).EntireRow.Delete
Sheets("Closed").Columns.AutoFit
Sheets("Closed").Select
Application.ScreenUpdating = True
Next Ws
End Sub
I have a workbook consisting of 6 worksheets (all with data referring to that location). I have a macro in place to loop through all the worksheets and look for the projects that are "closed" , it then cuts the rows based on the condition and transfers it to a worksheet called closed.
I'm wondering if there's a way of sending that row from the closed worksheet back to the sheet it came from if i changed the condition from = " closed to active "
I've searched site wide and cant find anything relating to it so any help would be greatly appreciated. Below is a sample of my macro i have in place at present.
Thank you
Sub LoopThroughSheets()
Application.ScreenUpdating = False
Dim Ws As Worksheet
For Each Ws In ActiveWorkbook.Worksheets
Dim i As Integer
Dim lRow As Long
lRow = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lRow
If Cells(i, 14).Value = "Closed" And Cells(i, 15).Value = "Closed" Then
Range(Cells(i, 1), Cells(i, 24)).Copy Sheets("Closed").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Range(Cells(i, 1), Cells(i, 24)).ClearContents
End If
Next
Columns("A").SpecialCells(4).EntireRow.Delete
Sheets("Closed").Columns.AutoFit
Sheets("Closed").Select
Application.ScreenUpdating = True
Next Ws
End Sub