VBA need help- Copy Rows if Cell contains - expanded

jdorfma

New Member
Joined
Jun 15, 2021
Messages
8
Office Version
  1. 2019
Platform
  1. Windows
Hello all!

I am building out a workbook where every sheet is for a different stage of a software installation. I am trying to aggregate the steps that fail by copying my fail rows into a summary sheet. I finally got them to pull, but they are pulling into the new sheet on the same row # as they are located in the original sheet.

Here is what I am using now:

Option Explicit

Sub Test()

Dim Cell As Range

With Sheets(15)
' loop column H untill last cell with value (not entire column)
For Each Cell In .Range("D1:D" & .Cells(.Rows.Count, "D").End(xlUp).Row)
If Cell.Value = "Fail" Then
' Copy>>Paste in 1-line (no need to use Select)
.Rows(Cell.Row).Copy Destination:=Sheets(2).Rows(Cell.Row)
End If
Next Cell
End With

End Sub




I need=
How can I modify to:
Pull row that has cell containing "Fail"
Copy row into master starting at Row 2 and consecutively down without overwriting
Run across all sheets- they are named per step of install - do i need to rename to "sheet1, sheet2, etc"
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,139
Office Version
  1. 365
Platform
  1. Windows
Can you post some sample data that we can test against?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 

jdorfma

New Member
Joined
Jun 15, 2021
Messages
8
Office Version
  1. 2019
Platform
  1. Windows
Unfortunately I cannot - its all proprietary info. Does this help at all? Thats about as good as I can get

This is what I pulled using your code - however, it is duplicitous, because I can change the sheet number back and forth and repull that data.

1623854851948.png
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,139
Office Version
  1. 365
Platform
  1. Windows
Just make up some "dummy data" that exhibits the error/issue you are having.
The important thing is to follow the same sheet/data structure that you have. It is important for us to be able to see the column headers and row numbers, so we can make sure that the code is written to work against your current data structure.

If you can use the tool mentioned in my previous post, that will allow us to copy your sample data and paste it to Excel on our side.
That way, we are both dealing with the same data, and we should be able to duplicate your issues.
 

jdorfma

New Member
Joined
Jun 15, 2021
Messages
8
Office Version
  1. 2019
Platform
  1. Windows
Just make up some "dummy data" that exhibits the error/issue you are having.
The important thing is to follow the same sheet/data structure that you have. It is important for us to be able to see the column headers and row numbers, so we can make sure that the code is written to work against your current data structure.

If you can use the tool mentioned in my previous post, that will allow us to copy your sample data and paste it to Excel on our side.
That way, we are both dealing with the same data, and we should be able to duplicate your issues.
Ive got everything situated but every time I try to run XL2BB it freezes my excel. I've gone through the process - deleted, reinstalled. no joy
 

Forum statistics

Threads
1,148,283
Messages
5,745,842
Members
423,981
Latest member
ph1l

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top