I am trying to copy the used range from a specified selection of worksheets, this time within
one workbook. I only want to take the header row from one sheet and not from the rest. I have used the helpful tip outlined below (only segment of code) but it copies all worksheets within the workbook with all headers included.
Sub CopyUsedRange()
Dim sh As Worksheet
Dim DestSh As Worksheet
Dim Last As Long
If SheetExists("Master") = True Then
MsgBox "The sheet Master already exist"
Exit Sub
End If
Application.ScreenUpdating = False
Set DestSh = Worksheets.Add
DestSh.Name = "Master"
For Each sh In ThisWorkbook.Worksheets
If sh.Name <> DestSh.Name Then
If sh.UsedRange.Count > 1 Then
Last = LastRow(DestSh)
sh.UsedRange.Copy DestSh.Cells(Last + 1, 1)
End If
End If
Next
Application.ScreenUpdating = True
End Sub
Similar to my other post but I have outlined more and refined my direction.
Thanks in advance.
Kristan
Bookmarks