Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VB Complie error - can You Help | Excel Programming | |||
Sheet(Array( Won't print as I expect it to | Excel Worksheet Functions | |||
Complie Error Help | Excel Programming | |||
complie error | Excel Programming | |||
Complie Error | Excel Programming |