VBA code to exclude rows with N/A Values in one cell of row when copying from workbook sheets into master sheet.

Dawnmark

New Member
Joined
Sep 21, 2014
Messages
1
I am very new to vba and am trying to pull a set range of summary data from all sheets in my workbook (I am using excel 2010)
My data is a table that contains 20 rows and 20 columns not all of the rows are populated with valid data on each sheet so i only want the valid rows.
The first 5 columns have dates, and id numbers in them. The 6th column (Column F) has N/A in it if there is no data, and the 7th - 21st Column (Column G-T) has a value of 0 in it if there is no data. these are populated with values (Numbers) if there is value data in them.
I want to only pull across the rows with values in them to my master sheet. (I dont want the rows with the N/A or zero Values pulled through)

I got the code below off of Mr excel, Thanks "MARK858" It works really well to pull all 20 rows from each sheet into my master, but can I add to the code to only pull the rows with values in them?

Also is there something I can write to eliminate one sheet (Sheet 7) from being included into the copying over into master.

Can anyone help me with this?
Thanks in advance for any help

CODE:

Sub CopyIt()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Master" Then
ws.Range("A17:N154").Copy Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Offset(1)
End If
Next
Application.ScreenUpdating = True
End Sub


From thread
[h=1]"VBA - copy same range of cells from every worksheet in workbook into list in another worksheet"[/h]
 
Last edited:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,203,251
Messages
6,054,384
Members
444,721
Latest member
BAFRA77

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
Back
Top