New to VBA here
I have a workbook with 30 sheets. Depending on the project different sheets are in scope. When in scope they will be unhidden and populated with data. All sheets have the same pre-defined columns from column B:N. What I want to do, is when everyone gave their input on the unhidden sheets, to collect all this information to one master sheet with only the populated rows. Not including the data from hidden sheets, as those obviously still will have the columns stated and thus have data. So only data from unhidden sheets is needed
I used below code, but it only retrieves information from one sheet
Option Explicit
Sub Create_Summary()
Dim sh As Worksheet, sumSht As Worksheet
Dim i As Long
Set sumSht = Sheets("Summary")
sumSht.Move after:=Worksheets(Worksheets.Count)
For i = 1 To Worksheets.Count - 1 ' once you moved "Summary" sheet as the workbook last one, you skip it by limiting loop to the penultimate sheets index
Worksheets(i).Range("B:M,N:N").Copy Destination:=sumSht.Cells(1, sumSht.Columns.Count).End(xlToLeft).Offset(, 1) ' qualify all destination references to "Summary" sheet
Next i
sumSht.Columns(1).Delete ' "Summary" sheet first column gest skipped by the above loop, so delete it
End Sub