Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default copy worksheet tab data into one sheet

I get run-time error '438':
object doesn't support this property or method

on highlighted: ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row

also 2003 SP2

"Gord Dibben" wrote:

Works for me in 2003.


Gord Dibben MS Excel MVP

On Fri, 15 Feb 2008 08:29:05 -0800, Bob wrote:

This removes row 1 from all the worksheets and does not copy or move anything
to the "Summary" page.

"Joel" wrote:

Sub make_summary()

Worksheets.Add befo=ThisWorkbook.Sheets(1)
Set SumSht = ActiveSheet
SumSht.Name = "Summary"

For Each sht In ThisWorkbook.Sheets
If sht.Name < "Summary" Then
SumLastRow = SumSht.Range("A" & Rows.Count).End(xlUp).Row
ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row
sht.Rows("1:" & ShtLastRow).Copy _
Destination:=SumSht.Rows(SumLastRow + 2)
End If
Next sht

End Sub

"Bob" wrote:

I have data in various tabs (some tabs have one row of data, others have
more) that I would like to move or copy into one worksheet. I would like to
use code to do this as some workbooks can have as much as 40 tabs while
others could have 10 tabs.





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default copy worksheet tab data into one sheet

Either sht.Index or sht.Name with Sheets(?)

ShtLastRow = Sheets(sht.Index).Range("A" & Rows.Count).End(xlUp).Row

"Bob" wrote:

I get run-time error '438':
object doesn't support this property or method

on highlighted: ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row

also 2003 SP2

"Gord Dibben" wrote:

Works for me in 2003.


Gord Dibben MS Excel MVP

On Fri, 15 Feb 2008 08:29:05 -0800, Bob wrote:

This removes row 1 from all the worksheets and does not copy or move anything
to the "Summary" page.

"Joel" wrote:

Sub make_summary()

Worksheets.Add befo=ThisWorkbook.Sheets(1)
Set SumSht = ActiveSheet
SumSht.Name = "Summary"

For Each sht In ThisWorkbook.Sheets
If sht.Name < "Summary" Then
SumLastRow = SumSht.Range("A" & Rows.Count).End(xlUp).Row
ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row
sht.Rows("1:" & ShtLastRow).Copy _
Destination:=SumSht.Rows(SumLastRow + 2)
End If
Next sht

End Sub

"Bob" wrote:

I have data in various tabs (some tabs have one row of data, others have
more) that I would like to move or copy into one worksheet. I would like to
use code to do this as some workbooks can have as much as 40 tabs while
others could have 10 tabs.





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default copy worksheet tab data into one sheet

But why have to make a revision to original?


Gord

On Fri, 15 Feb 2008 15:42:00 -0800, JLGWhiz
wrote:

Either sht.Index or sht.Name with Sheets(?)

ShtLastRow = Sheets(sht.Index).Range("A" & Rows.Count).End(xlUp).Row

"Bob" wrote:

I get run-time error '438':
object doesn't support this property or method

on highlighted: ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row

also 2003 SP2

"Gord Dibben" wrote:

Works for me in 2003.


Gord Dibben MS Excel MVP

On Fri, 15 Feb 2008 08:29:05 -0800, Bob wrote:

This removes row 1 from all the worksheets and does not copy or move anything
to the "Summary" page.

"Joel" wrote:

Sub make_summary()

Worksheets.Add befo=ThisWorkbook.Sheets(1)
Set SumSht = ActiveSheet
SumSht.Name = "Summary"

For Each sht In ThisWorkbook.Sheets
If sht.Name < "Summary" Then
SumLastRow = SumSht.Range("A" & Rows.Count).End(xlUp).Row
ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row
sht.Rows("1:" & ShtLastRow).Copy _
Destination:=SumSht.Rows(SumLastRow + 2)
End If
Next sht

End Sub

"Bob" wrote:

I have data in various tabs (some tabs have one row of data, others have
more) that I would like to move or copy into one worksheet. I would like to
use code to do this as some workbooks can have as much as 40 tabs while
others could have 10 tabs.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default copy worksheet tab data into one sheet

I don't know, Gord. It is kind of weird. I thought the original should
work, but when I ran a simulation just to check, I got the error also. Then
after you questioned why, I can't get the error to repeat. Now I am
wondering how I got the error in the first place. I think I will just go to
bed.

"Gord Dibben" wrote:

But why have to make a revision to original?


Gord

On Fri, 15 Feb 2008 15:42:00 -0800, JLGWhiz
wrote:

Either sht.Index or sht.Name with Sheets(?)

ShtLastRow = Sheets(sht.Index).Range("A" & Rows.Count).End(xlUp).Row

"Bob" wrote:

I get run-time error '438':
object doesn't support this property or method

on highlighted: ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row

also 2003 SP2

"Gord Dibben" wrote:

Works for me in 2003.


Gord Dibben MS Excel MVP

On Fri, 15 Feb 2008 08:29:05 -0800, Bob wrote:

This removes row 1 from all the worksheets and does not copy or move anything
to the "Summary" page.

"Joel" wrote:

Sub make_summary()

Worksheets.Add befo=ThisWorkbook.Sheets(1)
Set SumSht = ActiveSheet
SumSht.Name = "Summary"

For Each sht In ThisWorkbook.Sheets
If sht.Name < "Summary" Then
SumLastRow = SumSht.Range("A" & Rows.Count).End(xlUp).Row
ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row
sht.Rows("1:" & ShtLastRow).Copy _
Destination:=SumSht.Rows(SumLastRow + 2)
End If
Next sht

End Sub

"Bob" wrote:

I have data in various tabs (some tabs have one row of data, others have
more) that I would like to move or copy into one worksheet. I would like to
use code to do this as some workbooks can have as much as 40 tabs while
others could have 10 tabs.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default copy worksheet tab data into one sheet

Thanks for the feedback.

Nothing wrong with making a change if it will ensure stability.

Thta's two of you who got some sort of error with the original.


Gord

On Fri, 15 Feb 2008 20:01:00 -0800, JLGWhiz
wrote:

I don't know, Gord. It is kind of weird. I thought the original should
work, but when I ran a simulation just to check, I got the error also. Then
after you questioned why, I can't get the error to repeat. Now I am
wondering how I got the error in the first place. I think I will just go to
bed.

"Gord Dibben" wrote:

But why have to make a revision to original?


Gord

On Fri, 15 Feb 2008 15:42:00 -0800, JLGWhiz
wrote:

Either sht.Index or sht.Name with Sheets(?)

ShtLastRow = Sheets(sht.Index).Range("A" & Rows.Count).End(xlUp).Row

"Bob" wrote:

I get run-time error '438':
object doesn't support this property or method

on highlighted: ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row

also 2003 SP2

"Gord Dibben" wrote:

Works for me in 2003.


Gord Dibben MS Excel MVP

On Fri, 15 Feb 2008 08:29:05 -0800, Bob wrote:

This removes row 1 from all the worksheets and does not copy or move anything
to the "Summary" page.

"Joel" wrote:

Sub make_summary()

Worksheets.Add befo=ThisWorkbook.Sheets(1)
Set SumSht = ActiveSheet
SumSht.Name = "Summary"

For Each sht In ThisWorkbook.Sheets
If sht.Name < "Summary" Then
SumLastRow = SumSht.Range("A" & Rows.Count).End(xlUp).Row
ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row
sht.Rows("1:" & ShtLastRow).Copy _
Destination:=SumSht.Rows(SumLastRow + 2)
End If
Next sht

End Sub

"Bob" wrote:

I have data in various tabs (some tabs have one row of data, others have
more) that I would like to move or copy into one worksheet. I would like to
use code to do this as some workbooks can have as much as 40 tabs while
others could have 10 tabs.









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default copy worksheet tab data into one sheet

Here is another way to handle it

Sub sht()
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Sheets
If Not sht Is Nothing Then
With sht
lr = .Range("A" & Rows.Count).End(xlUp).Row
MsgBox lr & " Sheets(" & sht.Name & ")"
End With
End If
Next

"Bob" wrote:

I get run-time error '438':
object doesn't support this property or method

on highlighted: ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row

also 2003 SP2

"Gord Dibben" wrote:

Works for me in 2003.


Gord Dibben MS Excel MVP

On Fri, 15 Feb 2008 08:29:05 -0800, Bob wrote:

This removes row 1 from all the worksheets and does not copy or move anything
to the "Summary" page.

"Joel" wrote:

Sub make_summary()

Worksheets.Add befo=ThisWorkbook.Sheets(1)
Set SumSht = ActiveSheet
SumSht.Name = "Summary"

For Each sht In ThisWorkbook.Sheets
If sht.Name < "Summary" Then
SumLastRow = SumSht.Range("A" & Rows.Count).End(xlUp).Row
ShtLastRow = sht.Range("A" & Rows.Count).End(xlUp).Row
sht.Rows("1:" & ShtLastRow).Copy _
Destination:=SumSht.Rows(SumLastRow + 2)
End If
Next sht

End Sub

"Bob" wrote:

I have data in various tabs (some tabs have one row of data, others have
more) that I would like to move or copy into one worksheet. I would like to
use code to do this as some workbooks can have as much as 40 tabs while
others could have 10 tabs.





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
Copy worksheet tab data into one sheet Bob Excel Programming 2 February 15th 08 06:54 PM
How do I copy a graph to new worksheet and get data from new sheet? Elmer Smurdley[_2_] Charts and Charting in Excel 4 September 27th 07 07:26 PM
Copy worksheets to new worksheet and add a worksheet name column to new sheet. Lib Excel Programming 1 February 22nd 07 04:30 PM
copy data from one worksheet to identical sheet in different workbook akid12 Excel Discussion (Misc queries) 2 July 6th 05 02:55 AM
Copy and pasting specific sheet data to a master worksheet simora Excel Programming 4 May 9th 05 05:30 AM


All times are GMT +1. The time now is 05:06 PM.

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

About Us

"It's about Microsoft Excel"