|
Sub CopyCellData()
Dim RowEnd
Dim SheetName
Dim SheetObj
SheetName = ActiveSheet.Name
RowEnd = ActiveSheet.UsedRange.Rows.Count
For Each SheetObj In Worksheets
If SheetObj.Name <> SheetName Then
RowEnd = SheetObj.UsedRange.Rows.Count
SheetObj.Rows("1:" & RowEnd).Copy
RowEnd = Sheets(SheetName).UsedRange.Rows.Count
If RowEnd <> 1 Then
Sheets(SheetName).Range("A" & RowEnd + 1) = SheetObj.Name
Sheets(SheetName).Range("A" & RowEnd + 2).Select
Else
Sheets(SheetName).Range("A" & RowEnd) = SheetObj.Name
Sheets(SheetName).Range("A" & RowEnd + 1).Select
End If
ActiveSheet.Paste
End If
Next SheetObj
End Sub |
|