Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro for copying between Workbooks

I have been trying unsuccessfully to plagerise the macro contained within the
response -
http://www.microsoft.com/office/comm...577&sloc=en-us

The only differences I require is the ability to copy from whatever workbook
(x) is open (could be differing names) to a specifically named worksheet (a)
in another workbook. The data also needs to be copied in columns Q-W in
worksheet (a) where the key is in D - in the varied workbooks (x) which are
received the key is in B. Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro for copying between Workbooks

You just need to use copy with a destination

Thisworkbook.sheets("Sheet1").Range("A1:D5").copy
destination:=workbook("abc.xls").sheets("sheet2"). Range("C2")

You can make this look better by doing something like this

with Thisworkbook.sheets("Sheet1")
set source = .Range("A1:D5")
with workbook("abc.xls").sheets("sheet2")
source.copy destination:=.Range("C2")
end with
end with

"Miss Marple" wrote:

I have been trying unsuccessfully to plagerise the macro contained within the
response -
http://www.microsoft.com/office/comm...577&sloc=en-us

The only differences I require is the ability to copy from whatever workbook
(x) is open (could be differing names) to a specifically named worksheet (a)
in another workbook. The data also needs to be copied in columns Q-W in
worksheet (a) where the key is in D - in the varied workbooks (x) which are
received the key is in B. Thank you

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro for copying between Workbooks

Thank you for your response - I am unsure, however, where to insert this in
the existing code.

"Joel" wrote:

You just need to use copy with a destination

Thisworkbook.sheets("Sheet1").Range("A1:D5").copy
destination:=workbook("abc.xls").sheets("sheet2"). Range("C2")

You can make this look better by doing something like this

with Thisworkbook.sheets("Sheet1")
set source = .Range("A1:D5")
with workbook("abc.xls").sheets("sheet2")
source.copy destination:=.Range("C2")
end with
end with

"Miss Marple" wrote:

I have been trying unsuccessfully to plagerise the macro contained within the
response -
http://www.microsoft.com/office/comm...577&sloc=en-us

The only differences I require is the ability to copy from whatever workbook
(x) is open (could be differing names) to a specifically named worksheet (a)
in another workbook. The data also needs to be copied in columns Q-W in
worksheet (a) where the key is in D - in the varied workbooks (x) which are
received the key is in B. Thank you

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro for copying between Workbooks

I don't know if you need the other code. the website you posted has code
that performs a "find" function. If you know the range of cell s you want
copied and the location you are copying the cells to then you don't need the
other code.

"Miss Marple" wrote:

Thank you for your response - I am unsure, however, where to insert this in
the existing code.

"Joel" wrote:

You just need to use copy with a destination

Thisworkbook.sheets("Sheet1").Range("A1:D5").copy
destination:=workbook("abc.xls").sheets("sheet2"). Range("C2")

You can make this look better by doing something like this

with Thisworkbook.sheets("Sheet1")
set source = .Range("A1:D5")
with workbook("abc.xls").sheets("sheet2")
source.copy destination:=.Range("C2")
end with
end with

"Miss Marple" wrote:

I have been trying unsuccessfully to plagerise the macro contained within the
response -
http://www.microsoft.com/office/comm...577&sloc=en-us

The only differences I require is the ability to copy from whatever workbook
(x) is open (could be differing names) to a specifically named worksheet (a)
in another workbook. The data also needs to be copied in columns Q-W in
worksheet (a) where the key is in D - in the varied workbooks (x) which are
received the key is in B. Thank you

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro for copying between Workbooks

Hi

I do need the find facility as the "incoming" worksheet needs to update one
or two records in a master worksheet in a seperate workbook(columns Q-W).
The unique Identifier is in Column B in the "incoming" spreadsheet and Column
D in the "Master"

"Joel" wrote:

I don't know if you need the other code. the website you posted has code
that performs a "find" function. If you know the range of cell s you want
copied and the location you are copying the cells to then you don't need the
other code.

"Miss Marple" wrote:

Thank you for your response - I am unsure, however, where to insert this in
the existing code.

"Joel" wrote:

You just need to use copy with a destination

Thisworkbook.sheets("Sheet1").Range("A1:D5").copy
destination:=workbook("abc.xls").sheets("sheet2"). Range("C2")

You can make this look better by doing something like this

with Thisworkbook.sheets("Sheet1")
set source = .Range("A1:D5")
with workbook("abc.xls").sheets("sheet2")
source.copy destination:=.Range("C2")
end with
end with

"Miss Marple" wrote:

I have been trying unsuccessfully to plagerise the macro contained within the
response -
http://www.microsoft.com/office/comm...577&sloc=en-us

The only differences I require is the ability to copy from whatever workbook
(x) is open (could be differing names) to a specifically named worksheet (a)
in another workbook. The data also needs to be copied in columns Q-W in
worksheet (a) where the key is in D - in the varied workbooks (x) which are
received the key is in B. Thank you



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro for copying between Workbooks

Do this code help?

Sub test()

With ThisWorkbook.Sheets("Sheet1")
Set Source = .Range("A1:D5")
With Workbooks("abc.xls").Sheets("incoming")
Set c = .Columns("B:B").Find(what:="Identifier", _
LookIn:=xlValues)
If Not c Is Nothing Then
Source.Copy Destination:=.c.Offset(1, 0)
End If
End With
Set Source = .Range("E7:F10")
With Workbooks("abc.xls").Sheets("master")
Set c = .Columns("D:D").Find(what:="Identifier", _
LookIn:=xlValues)
If Not c Is Nothing Then
Source.Copy Destination:=.c.Offset(1, 0)
End If
End With
End With
End Sub


"Miss Marple" wrote:

Hi

I do need the find facility as the "incoming" worksheet needs to update one
or two records in a master worksheet in a seperate workbook(columns Q-W).
The unique Identifier is in Column B in the "incoming" spreadsheet and Column
D in the "Master"

"Joel" wrote:

I don't know if you need the other code. the website you posted has code
that performs a "find" function. If you know the range of cell s you want
copied and the location you are copying the cells to then you don't need the
other code.

"Miss Marple" wrote:

Thank you for your response - I am unsure, however, where to insert this in
the existing code.

"Joel" wrote:

You just need to use copy with a destination

Thisworkbook.sheets("Sheet1").Range("A1:D5").copy
destination:=workbook("abc.xls").sheets("sheet2"). Range("C2")

You can make this look better by doing something like this

with Thisworkbook.sheets("Sheet1")
set source = .Range("A1:D5")
with workbook("abc.xls").sheets("sheet2")
source.copy destination:=.Range("C2")
end with
end with

"Miss Marple" wrote:

I have been trying unsuccessfully to plagerise the macro contained within the
response -
http://www.microsoft.com/office/comm...577&sloc=en-us

The only differences I require is the ability to copy from whatever workbook
(x) is open (could be differing names) to a specifically named worksheet (a)
in another workbook. The data also needs to be copied in columns Q-W in
worksheet (a) where the key is in D - in the varied workbooks (x) which are
received the key is in B. Thank you

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
Copying across workbooks judith Excel Programming 1 September 5th 07 09:17 AM
Copying from other Workbooks SusieQ Excel Discussion (Misc queries) 0 January 30th 06 12:44 PM
Copying between Workbooks Stuart[_21_] Excel Programming 2 November 2nd 05 01:37 PM
Help with Macro (copying data from multiple workbooks) Tim Harding Excel Discussion (Misc queries) 1 February 5th 05 10:37 PM
Copying Macro to Several Workbooks Fast nickg420[_3_] Excel Programming 0 July 12th 04 08:38 PM


All times are GMT +1. The time now is 08:06 AM.

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"