Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to copy range to diffrent workbook ?

Hi ,

Sorry for my English , hope you'll understand

I need to copy values of (50+) * 3 Cells
from about 60 workbooks ( i called them source workbooks ) to 1 Workbook
(destination workbook) .

Tried the following :

In every source workbook :

Set tempRange = Sheet1.Range(Cells(2, 1), Cells(RCount + 1, 9))
tempRange.Copy


and in destination workbook :

Sheet1.Cells(1, 1).PasteSpecial Paste:=xlValues,Operation:=xlNone
,SkipBlanks : = False, Transpose:=False

It works , but before i close one of the source workbook it asks
what to do with data in clipboard . It's pretty frustrating



So i wrote following function :

in source workbook :

Function getValues() As Variant
Dim TempArray As Variant
Dim Ilosc As Long
Dim i As Long
MaxRow = Sheet1.Cells(Cells.Rows.Count, 3).End(xlUp).Row
ReDim TempArray(1 To Ilosc, 1 To 3)
For i = 1 To MaxRow
TempArray(i, 1) = Arkusz1.Cells(i + 1, 2)
TempArray(i, 2) = Arkusz1.Cells(i + 1, 4)
TempArray(i, 3) = Arkusz1.Cells(i + 1, 9).Value2
Next i
getValues = TempArray
End Function


and in destination Workbook :

Dim MyVariable
Set MyRange = Sheet1.Range(Cells(RowStart, 1), Cells(RowEnd,3))
MyVariable= Application.Run("'" & NameofSourceWorkbook & "'" & "!" &
"getValues")
MyRange.Value=MyVariable


But it doesn't work i.e. there's no values in MyRange . Anyone knows
what's wrong ? Or have anyone idea how to solve this problem ?

TIA






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default How to copy range to diffrent workbook ?

Have you tried Application.DisplayAlerts = False

RBS

"mg" wrote in message
...
Hi ,

Sorry for my English , hope you'll understand

I need to copy values of (50+) * 3 Cells
from about 60 workbooks ( i called them source workbooks ) to 1 Workbook
(destination workbook) .

Tried the following :

In every source workbook :

Set tempRange = Sheet1.Range(Cells(2, 1), Cells(RCount + 1, 9))
tempRange.Copy


and in destination workbook :

Sheet1.Cells(1, 1).PasteSpecial Paste:=xlValues,Operation:=xlNone
,SkipBlanks : = False, Transpose:=False

It works , but before i close one of the source workbook it asks
what to do with data in clipboard . It's pretty frustrating



So i wrote following function :

in source workbook :

Function getValues() As Variant
Dim TempArray As Variant
Dim Ilosc As Long
Dim i As Long
MaxRow = Sheet1.Cells(Cells.Rows.Count, 3).End(xlUp).Row
ReDim TempArray(1 To Ilosc, 1 To 3)
For i = 1 To MaxRow
TempArray(i, 1) = Arkusz1.Cells(i + 1, 2)
TempArray(i, 2) = Arkusz1.Cells(i + 1, 4)
TempArray(i, 3) = Arkusz1.Cells(i + 1, 9).Value2
Next i
getValues = TempArray
End Function


and in destination Workbook :

Dim MyVariable
Set MyRange = Sheet1.Range(Cells(RowStart, 1), Cells(RowEnd,3))
MyVariable= Application.Run("'" & NameofSourceWorkbook & "'" & "!" &
"getValues")
MyRange.Value=MyVariable


But it doesn't work i.e. there's no values in MyRange . Anyone knows
what's wrong ? Or have anyone idea how to solve this problem ?

TIA







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 range from one workbook to other in C# asp newbie Excel Worksheet Functions 0 May 17th 06 06:44 AM
copy a same referance from diffrent worksheet on another file copy Excel Worksheet Functions 0 March 22nd 06 01:00 PM
copy a range from another workbook Spencer Hutton[_3_] Excel Programming 1 December 22nd 04 05:07 PM
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 12:01 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"