Robert Bradshaw
New Member
- Joined
- Aug 14, 2020
- Messages
- 3
- Office Version
- 2016
- Platform
- Windows
Hello all this is my first post and also learning vba. I was hoping to get some help solving this issue. I am trying to copy and paste rows with a true value of "open" in column A to a specified worksheet("Open Disc") from all available worksheets. When pasting all true values, I would like for it to make a running list as it transitions through worksheets without large gaps of blank spacing. The current vba i have been working with is searching forbthe value of open but when found it pastes to the same row/col as its found in. When searching multiple worksheets it pastes over rows of matching row/col's. Is there a way to search all worksheets, copy true value row in col A and paste to specified worksheet one after another until all sheets are searched?
Code used:
Sub filter()
Dim cell as range
Dim xsheet as integer
For xsheet = 2 to sheets.count
With worksheets(xsheet)
For each cell.value = "open" then
Sheets("Open Disc").unprotected
.rows(cell.row).copy sheets("Open. Disc").rows(cell.row)
End if
Next cell
Sheets("Open Disc").protect
Range ("B1").select
End with
Next xsheet
End sub
Code used:
Sub filter()
Dim cell as range
Dim xsheet as integer
For xsheet = 2 to sheets.count
With worksheets(xsheet)
For each cell.value = "open" then
Sheets("Open Disc").unprotected
.rows(cell.row).copy sheets("Open. Disc").rows(cell.row)
End if
Next cell
Sheets("Open Disc").protect
Range ("B1").select
End with
Next xsheet
End sub