Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Combine Multiple Sheets: Complie Error, Expect Array

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.

"Ron de Bruin" wrote:

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Complie error - can You Help Anthony Excel Programming 2 October 9th 05 10:51 PM
Sheet(Array( Won't print as I expect it to [email protected] Excel Worksheet Functions 0 June 21st 05 11:34 AM
Complie Error Help JMay Excel Programming 4 January 24th 05 04:33 AM
complie error brian Excel Programming 2 December 13th 04 06:51 PM
Complie Error chris huber Excel Programming 3 January 14th 04 09:57 AM


All times are GMT +1. The time now is 04:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"