View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
BEEJAY BEEJAY is offline
external usenet poster
 
Posts: 247
Default Combine Multiple Sheets: Complie Error, Expect Array

Am trying to use the following (from Ron dB)
Get error shown above at line indicated by

Is there supposed to be other lines at the start of this code?

Dim sh As Worksheet
Dim DestSh As Worksheet
Dim Last As Long

On Error Resume Next
If Len(ThisWorkbook.Worksheets.Item("Master").Name) = 0 Then
On Error GoTo 0
Application.ScreenUpdating = False
Set DestSh = ThisWorkbook.Worksheets.Add
DestSh.Name = "Master"
For Each sh In ThisWorkbook.Worksheets
If sh.Name < DestSh.Name Then
Last = LastRow(DestSh)


sh.UsedRange.Copy DestSh.Cells(Last + 1, "A")
End If
Next
DestSh.Cells(1).Select

Application.ScreenUpdating = True

Else
MsgBox "The Sheet Master already Exists"
End If