#1   Report Post  
Posted to microsoft.public.excel.programming
Junior Member
 
Posts: 21
Default ARRAY QUERY

I have the following:

Dim vtInput() As Variant
totalrows = ActiveSheet.UsedRange.Rows.Count
vtInput = Range(Cells(1, 1), Cells(totalrows, 2))
Sheets("BB DATA").Select
ActiveSheet.Range(Cells(5, 1), Cells(totalrows, 2)) = vtInput

The above works fine.

Now, if I change the last line to: ActiveSheet.Range(Cells(5, 1),
Cells(totalrows, 1)) = vtInput;
that works fine as well, giving me the first column of my 2-dimension
array.

How can I paste only the second column of my array?

TIA

  #2   Report Post  
Posted to microsoft.public.excel.programming
Junior Member
 
Posts: 21
Default ARRAY QUERY

CORRECTION:

I am pasting to Row 1.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default ARRAY QUERY

ActiveSheet.Range(Cells(5, 1), Cells(totalrows, 1)) = _
Application.Index(vtInput, 0, 2)

Alan Beban

JingleRock wrote:
I have the following:

Dim vtInput() As Variant
totalrows = ActiveSheet.UsedRange.Rows.Count
vtInput = Range(Cells(1, 1), Cells(totalrows, 2))
Sheets("BB DATA").Select
ActiveSheet.Range(Cells(5, 1), Cells(totalrows, 2)) = vtInput

The above works fine.

Now, if I change the last line to: ActiveSheet.Range(Cells(5, 1),
Cells(totalrows, 1)) = vtInput;
that works fine as well, giving me the first column of my 2-dimension
array.

How can I paste only the second column of my array?

TIA

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default ARRAY QUERY

You're pasting the second column of the array to Row 1 of some range????

Alan Beban

JingleRock wrote:
CORRECTION:

I am pasting to Row 1.

  #5   Report Post  
Posted to microsoft.public.excel.programming
Junior Member
 
Posts: 21
Default ARRAY QUERY

Alan, Thanks very much -- that is exactly what I was looking for.
Sorry about the confusion my CORRECTION. What I was trying to
say was that I was pasting exactly the same number of rows to my Sheet
that are in my Array, but I now see that is not a necessity.
Thanks again for your prompt reply.

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 import web query as array? Sam_stock Excel Discussion (Misc queries) 0 April 26th 07 03:58 PM
Array data in SQL Query? mazzarin Excel Programming 4 June 26th 06 08:07 PM
SQL Query Destination as an array varable [email protected] Excel Programming 2 June 19th 06 07:31 PM
Web Query & Array Questions! gr8guy Excel Programming 1 August 25th 04 11:05 PM
Query for data in an array anonymous Excel Programming 2 January 13th 04 12:51 PM


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