View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Combine Multiple Sheets: Complie Error, Expect Array

Hi BEEJAY

http://www.rondebruin.nl/copy2.htm
Have you copy the function LastRow in the module ?

--
Regards Ron de Bruin
http://www.rondebruin.nl



"BEEJAY" wrote in message ...
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