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]
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: