Combine Multiple Sheets: Complie Error, Expect Array


G

Guest

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

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
 
Ad

Advertisements

Ad

Advertisements

G

Guest

Ron: You are correct. I did not have the "lastRow" function in module.

Also, now that I look at the code again after a refreshing week-end,
I see that this is not the code I need.
Sorry for wasting your time.
I might have to get back to you if I can't get my 'long' version (macro
recorder)
to work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top