Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Copy Range, Paste Value in New Workbook

Hi All,

I am sure this is not as difficult as my man flu addled brain is making it.

I have a number of worksheets in a workbook that have the relevant
information I want to copy in the same range (A71:I71). I then have a
seperate workbook that I want to paste the values onto the next blank row, so
I can make a summary page.

The following code is what I have cobbled together from various posts (Kudos
to those who may recognise bits of their code! I know some of it came from
Ron db)

The source ranges will be present on all of the worksheets within the
workbook but will all have different names and the number of worksheets will
differ everytime this macro is run. The code seems to fall down as it only
copy & pastes from the first worksheet and then seems to ignore the rest!

The source worksheets are in a password protected workbook (that bit works
fine!)

Any help greatly appreciated.

Sub CopyDetails()

Dim wbk As Workbook
Dim sh As Worksheet
Dim Sourcewb As Workbook

Set wbk = Workbooks.Open(Filename:="filelocation", UpdateLinks:=True,
Password:="password")
Set Sourcewb = ThisWorkbook

For Each sh In Sourcewb.Worksheets
Range("A71:I71").Copy Destination:=Workbooks("Report").Worksheets("TM
Overview").Cells(Rows.Count, 1).End(xlUp)(2)
Next sh

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Copy Range, Paste Value in New Workbook

Make sure you pick up the values in the correct sheet:

Sh.Range("A71:I71").Copy _
Destination:=Workbooks("Report").Worksheets("TM Overview") _
.Cells(Rows.Count, 1).End(xlUp)(2)

Those unqualified ranges will point at the active sheet.



BaggieDan wrote:

Hi All,

I am sure this is not as difficult as my man flu addled brain is making it.

I have a number of worksheets in a workbook that have the relevant
information I want to copy in the same range (A71:I71). I then have a
seperate workbook that I want to paste the values onto the next blank row, so
I can make a summary page.

The following code is what I have cobbled together from various posts (Kudos
to those who may recognise bits of their code! I know some of it came from
Ron db)

The source ranges will be present on all of the worksheets within the
workbook but will all have different names and the number of worksheets will
differ everytime this macro is run. The code seems to fall down as it only
copy & pastes from the first worksheet and then seems to ignore the rest!

The source worksheets are in a password protected workbook (that bit works
fine!)

Any help greatly appreciated.

Sub CopyDetails()

Dim wbk As Workbook
Dim sh As Worksheet
Dim Sourcewb As Workbook

Set wbk = Workbooks.Open(Filename:="filelocation", UpdateLinks:=True,
Password:="password")
Set Sourcewb = ThisWorkbook

For Each sh In Sourcewb.Worksheets
Range("A71:I71").Copy Destination:=Workbooks("Report").Worksheets("TM
Overview").Cells(Rows.Count, 1).End(xlUp)(2)
Next sh

End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Copy Range, Paste Value in New Workbook

Thank you sir,

2 little letters sorted it!

"Dave Peterson" wrote:

Make sure you pick up the values in the correct sheet:

Sh.Range("A71:I71").Copy _
Destination:=Workbooks("Report").Worksheets("TM Overview") _
.Cells(Rows.Count, 1).End(xlUp)(2)

Those unqualified ranges will point at the active sheet.



BaggieDan wrote:

Hi All,

I am sure this is not as difficult as my man flu addled brain is making it.

I have a number of worksheets in a workbook that have the relevant
information I want to copy in the same range (A71:I71). I then have a
seperate workbook that I want to paste the values onto the next blank row, so
I can make a summary page.

The following code is what I have cobbled together from various posts (Kudos
to those who may recognise bits of their code! I know some of it came from
Ron db)

The source ranges will be present on all of the worksheets within the
workbook but will all have different names and the number of worksheets will
differ everytime this macro is run. The code seems to fall down as it only
copy & pastes from the first worksheet and then seems to ignore the rest!

The source worksheets are in a password protected workbook (that bit works
fine!)

Any help greatly appreciated.

Sub CopyDetails()

Dim wbk As Workbook
Dim sh As Worksheet
Dim Sourcewb As Workbook

Set wbk = Workbooks.Open(Filename:="filelocation", UpdateLinks:=True,
Password:="password")
Set Sourcewb = ThisWorkbook

For Each sh In Sourcewb.Worksheets
Range("A71:I71").Copy Destination:=Workbooks("Report").Worksheets("TM
Overview").Cells(Rows.Count, 1).End(xlUp)(2)
Next sh

End Sub


--

Dave Peterson
.

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
How to copy a range of cells and paste into a new workbook in differentcolumns Mas[_4_] Excel Discussion (Misc queries) 3 August 16th 11 02:57 PM
Column range to search from a source workbook and then copy/paste DanS Excel Programming 0 February 10th 09 11:29 PM
Copy paste a range from one Workbook to another Kc-Mass Excel Programming 2 December 13th 06 01:18 AM
Need a macro to copy a range in one workbook and paste into another workbook Paul Excel Programming 8 July 1st 04 07:42 AM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM


All times are GMT +1. The time now is 11:23 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"