Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copying cells from one wkbk to another


I want to copy a series of cells from wkbk to another, but I need to do
it one cell at a time (because of some additional processing) instead
of just a straight select/copy/paste. How do I define the range of
cells in my destination workbook so I can copy to them. I need to open
the destination wkbk & define the destination cells. This code kind of
gives the idea...

Sub Macro1()
Dim ocells As Range
Set ocells = Range("a1:a5")

Dim nwkbk As Workbook
Set nwkbk = Workbooks.Open(ThisWorkbook.Path & "\Book2.xls")

dim ncells as range
set ncells = ??????

For i = 1 To 5
ncells(i) = ocells(i) ' How do I do this across wkbks then save
nwkbk
Next i

nwkbk.Save
nwkbk.Close
End Sub


--
mwc0914
------------------------------------------------------------------------
mwc0914's Profile: http://www.excelforum.com/member.php...o&userid=24130
View this thread: http://www.excelforum.com/showthread...hreadid=572343

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default copying cells from one wkbk to another

Use the top left corner of the destination and make it the same size


Sub Macro1()
Dim ocells As Range
Set ocells = Range("a1:a5")

Dim nwkbk As Workbook
Set nwkbk = Workbooks.Open(ThisWorkbook.Path & "\Book2.xls")

dim ncells as range
set ncells = Range("B10").Resize(oCells.Rows.count,oCells.colum ns.count)

For i = 1 To 5
ncells(i) = ocells(i) ' How do I do this across wkbks then save
nwkbk
Next i

nwkbk.Save
nwkbk.Close
End Sub

--
Regards,
Tom Ogilvy

"mwc0914" wrote:


I want to copy a series of cells from wkbk to another, but I need to do
it one cell at a time (because of some additional processing) instead
of just a straight select/copy/paste. How do I define the range of
cells in my destination workbook so I can copy to them. I need to open
the destination wkbk & define the destination cells. This code kind of
gives the idea...

Sub Macro1()
Dim ocells As Range
Set ocells = Range("a1:a5")

Dim nwkbk As Workbook
Set nwkbk = Workbooks.Open(ThisWorkbook.Path & "\Book2.xls")

dim ncells as range
set ncells = ??????

For i = 1 To 5
ncells(i) = ocells(i) ' How do I do this across wkbks then save
nwkbk
Next i

nwkbk.Save
nwkbk.Close
End Sub


--
mwc0914
------------------------------------------------------------------------
mwc0914's Profile: http://www.excelforum.com/member.php...o&userid=24130
View this thread: http://www.excelforum.com/showthread...hreadid=572343


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 cell info from one sheet to another in the same wkbk shellyjohnson Excel Discussion (Misc queries) 1 June 16th 09 07:09 PM
Can't Alt Tab from wkbk to wkbk Help! Paulg Excel Discussion (Misc queries) 1 August 15th 06 05:34 PM
formula to add cells in multiple shts in the same wkbk busker Excel Worksheet Functions 2 August 9th 06 09:34 PM
run a procedure in 1 wkbk from another wkbk carenla Excel Programming 1 July 7th 05 05:40 PM
HowTo add and name 2 wks to wkbk Dan Excel Programming 2 March 5th 05 09:36 PM


All times are GMT +1. The time now is 01:13 AM.

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"