ahyaman718
New Member
- Joined
- Nov 3, 2016
- Messages
- 6
I have a number workbooks that has a hidden worksheet, and I would like to copy the lines from the hidden work sheets consolidating them into one worksheet. This is code I have so far that is not working, please be gentle I am a VB code novice. The Hidden Worksheet has a Title row so I want to exclude that row.
Sub FilterandCopy()
Dim FolderPath As String, Filepath As String, Filename As String
FolderPath = "C:\TestFolder"
Filepath = FolderPath & "*.xls*"
Filename = Dir(Filepath) Do While Filename <> ""
Workbooks.Open (FolderPath & Filename), 0
Worksheets("HiddenWorkSheetName").Activate
ActiveSheet.UsedRange.SpecialCells(xlCellTypeVisible).Copy _
Destination:=Worksheets("Sheet2").Range("A2").End(xlDown).Offset(1, 0)
ActiveWorkbook.Close SaveChanges:=False
Filename = Dir
Loop
End Sub
Sub FilterandCopy()
Dim FolderPath As String, Filepath As String, Filename As String
FolderPath = "C:\TestFolder"
Filepath = FolderPath & "*.xls*"
Filename = Dir(Filepath) Do While Filename <> ""
Workbooks.Open (FolderPath & Filename), 0
Worksheets("HiddenWorkSheetName").Activate
ActiveSheet.UsedRange.SpecialCells(xlCellTypeVisible).Copy _
Destination:=Worksheets("Sheet2").Range("A2").End(xlDown).Offset(1, 0)
ActiveWorkbook.Close SaveChanges:=False
Filename = Dir
Loop
End Sub