Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Reading Chunks of Excel Data

Hi

Is there a VBA technique €“ direct or indirect €“ to read chunks of cells
rather than copying. The following reads b4 to both a1 and a4.

Range("a1,a4").Value = Range("b4,b1").Value

If there is none is there a technique to do copying without selecting or
activating copied or receiving area.

Can someone help?

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Reading Chunks of Excel Data

Why don't you want to use COPY. You DON'T need to select or activate cells
to use copy. You must be using the Macro Recorder code as your examples. I
always modify the Recorded macros to remove the activate and selection. for
example

Workbooks("book1.xls").Sheets("Sheet1").Range("A1: D4").Copy _
Destination:=Workbooks("book2.xls").Sheets("Sheet1 ").Range("A1")


or

With Workbooks("book1.xls").Sheets("Sheet1")
.Range("A1:D4").Copy _
Destination:=Workbooks("book2.xls").Sheets("Sheet1 ").Range("A1")
end With

or

Set DestSht = Workbooks("book2.xls").Sheets("Sheet1")
With Workbooks("book1.xls").Sheets("Sheet1")
.Range("A1:D4").Copy Destination:=DestSht.Range("A1")
end With


"Varne" wrote:

Hi

Is there a VBA technique €“ direct or indirect €“ to read chunks of cells
rather than copying. The following reads b4 to both a1 and a4.

Range("a1,a4").Value = Range("b4,b1").Value

If there is none is there a technique to do copying without selecting or
activating copied or receiving area.

Can someone help?

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Reading Chunks of Excel Data

Hi

Thanks for the answer. I avoid copying and usually use cell by cell reading
but it takes too long if it has to read a lot.

Thanks.

"Joel" wrote:

Why don't you want to use COPY. You DON'T need to select or activate cells
to use copy. You must be using the Macro Recorder code as your examples. I
always modify the Recorded macros to remove the activate and selection. for
example

Workbooks("book1.xls").Sheets("Sheet1").Range("A1: D4").Copy _
Destination:=Workbooks("book2.xls").Sheets("Sheet1 ").Range("A1")


or

With Workbooks("book1.xls").Sheets("Sheet1")
.Range("A1:D4").Copy _
Destination:=Workbooks("book2.xls").Sheets("Sheet1 ").Range("A1")
end With

or

Set DestSht = Workbooks("book2.xls").Sheets("Sheet1")
With Workbooks("book1.xls").Sheets("Sheet1")
.Range("A1:D4").Copy Destination:=DestSht.Range("A1")
end With


"Varne" wrote:

Hi

Is there a VBA technique €“ direct or indirect €“ to read chunks of cells
rather than copying. The following reads b4 to both a1 and a4.

Range("a1,a4").Value = Range("b4,b1").Value

If there is none is there a technique to do copying without selecting or
activating copied or receiving area.

Can someone help?

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Reading Chunks of Excel Data

Hi!

This is for fellow users;

Whilst trying codes shown by Joel I found something. The following confusing
codes can be used to copy data to many destinations;

Range("j1").Copy Range("j1:j500000")

"Varne" wrote:

Hi

Thanks for the answer. I avoid copying and usually use cell by cell reading
but it takes too long if it has to read a lot.

Thanks.

"Joel" wrote:

Why don't you want to use COPY. You DON'T need to select or activate cells
to use copy. You must be using the Macro Recorder code as your examples. I
always modify the Recorded macros to remove the activate and selection. for
example

Workbooks("book1.xls").Sheets("Sheet1").Range("A1: D4").Copy _
Destination:=Workbooks("book2.xls").Sheets("Sheet1 ").Range("A1")


or

With Workbooks("book1.xls").Sheets("Sheet1")
.Range("A1:D4").Copy _
Destination:=Workbooks("book2.xls").Sheets("Sheet1 ").Range("A1")
end With

or

Set DestSht = Workbooks("book2.xls").Sheets("Sheet1")
With Workbooks("book1.xls").Sheets("Sheet1")
.Range("A1:D4").Copy Destination:=DestSht.Range("A1")
end With


"Varne" wrote:

Hi

Is there a VBA technique €“ direct or indirect €“ to read chunks of cells
rather than copying. The following reads b4 to both a1 and a4.

Range("a1,a4").Value = Range("b4,b1").Value

If there is none is there a technique to do copying without selecting or
activating copied or receiving area.

Can someone help?

Thanks.

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
Reading data arrays from multiple data files in excel Hankjam[_2_] Excel Discussion (Misc queries) 0 February 7th 08 08:29 PM
Reading data from PPT and purge data to Excel and image [email protected] Excel Programming 1 January 17th 08 06:04 AM
Reading data from excel P.Nishanthan Excel Programming 0 May 3rd 07 09:20 AM
Reading excel data into another aplication Sean Bartleet Excel Programming 2 October 19th 05 02:15 PM
Why does this keep blowing chunks Jon Turner Excel Programming 7 June 26th 04 02:16 PM


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