Hello!
I have a Macro (listed below) which works PERFECTLY!
It takes multiple worksheets and joins all the data found across all the multiple sheets into 1 Worksheet called "Combined".
Unfortunately, I have 1 hidden worksheet called "lists" that I would prefer to keep out of the macro but it takes the information from there and uses it too. I do not want this.
-------------------
My question is: Is there a Statement or Expression I can add to this macro to prevent it from joining that particular sheet called lists?
Sub Combine()
Dim J As Integer
On Error Resume Next
Sheets(1).Select
Worksheets.Add
Sheets(1).Name = "Combined"
Sheets(2).Activate
Range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).Range("A1")
For J = 2 To Sheets.Count
Sheets(J).Activate
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.Copy Destination:=Sheets(1).Range("A1000000").End(xlUp)(2)
Next
End Sub
Any help in this matter would be greatly appreciated! This is my first question on here! :O)
I have a Macro (listed below) which works PERFECTLY!
It takes multiple worksheets and joins all the data found across all the multiple sheets into 1 Worksheet called "Combined".
Unfortunately, I have 1 hidden worksheet called "lists" that I would prefer to keep out of the macro but it takes the information from there and uses it too. I do not want this.
-------------------
My question is: Is there a Statement or Expression I can add to this macro to prevent it from joining that particular sheet called lists?
Sub Combine()
Dim J As Integer
On Error Resume Next
Sheets(1).Select
Worksheets.Add
Sheets(1).Name = "Combined"
Sheets(2).Activate
Range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).Range("A1")
For J = 2 To Sheets.Count
Sheets(J).Activate
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.Copy Destination:=Sheets(1).Range("A1000000").End(xlUp)(2)
Next
End Sub
Any help in this matter would be greatly appreciated! This is my first question on here! :O)