I am trying to create a list of residents, unit types, and unit numbers. I have 3 problems with the following code.
1) The code ignores sheets that have no value in the specified cell. I need it to return a blank cell for those in order to keep the data in each column matched with the sheet it came from.
2) The code includes data from hidden sheets. I only want to list data from unhidden sheets. And more specifically, I want to omit data from unhidden sheets that have their tab colored black.
3) The code includes data from the sheet named "Totals" which I thought I was telling it to ignore.
Dim WS As Worksheet
Application.ScreenUpdating = False
Sheets("Resident List by Unit").Activate
For Each WS In Worksheets
If WS.Name <> "Resident List by Unit" And WS.Name <> "Totals" Then
WS.Range("b4").Copy
ActiveSheet.Paste Range("A65536").End(xlUp).Offset(1, 0)
End If
Next WS
For Each WS In Worksheets
If WS.Name <> "Resident List by Unit" And WS.Name <> "Totals" Then
WS.Range("b5").Copy
ActiveSheet.Paste Range("b65536").End(xlUp).Offset(1, 0)
End If
Next WS
For Each WS In Worksheets
If WS.Name <> "Resident List by Unit" And WS.Name <> "Totals" Then
WS.Range("b3").Copy
ActiveSheet.Paste Range("c65536").End(xlUp).Offset(1, 0)
End If
Next WS
Application.ScreenUpdating = True
End Sub
Bookmarks