Frustrated with this problem...
I have a workbook with multiple sheets. I want to take the value of Cell A2 from every sheet (including Blank cells), and Paste it into Cell A2 of this "Master" sheet and offset the row by 1 and continue pasting row after row.
The problem I have is that the above code ignores blank cells in the sheets. I think the problem is the .End(xlUp) property. But how do I modify the code so that it pastes the value starting in Cell A2 (including blanks) and offsets by 1 row down?
I have a workbook with multiple sheets. I want to take the value of Cell A2 from every sheet (including Blank cells), and Paste it into Cell A2 of this "Master" sheet and offset the row by 1 and continue pasting row after row.
Code:
Sub CopyIt()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Master" Then
ws.Range("A2").Copy
Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Offset(1,0).PasteSpecial xlPasteValues
End If
Next
Application.ScreenUpdating = True
End Sub
The problem I have is that the above code ignores blank cells in the sheets. I think the problem is the .End(xlUp) property. But how do I modify the code so that it pastes the value starting in Cell A2 (including blanks) and offsets by 1 row down?