Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ozz Ozz is offline
external usenet poster
 
Posts: 6
Default query result through array on worksheet

I have a query in Access which results I put into a two dimensional array in
Excel through ADO.

The array has the columns month & count.
What I would like to do is place the results in a worksheet neatly putting
the count of month 5 in the cell for month 5.

Only problem is, when there is no count in month 5, it is not shown in the
query.
So if the query results a

Month: Count
1: 50
2: 29
3: 11
4: 40
6: 30

It misses month 5. On the worksheet, month 5 should be displayed as 0.

I've tried Vlookup but that didn't work.
How do I do this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default query result through array on worksheet

Just transfer the values to a second fixed array with 2 column and 12 rows.
Something like this:

Dim i As Long
Dim arr2(1 To 12, 1 To 2)

'prepare the final array
For i = 1 To 12
arr2(i, 1) = i
arr2(i, 2) = 0
Next

'add the values from the first array
For i = 1 To UBound(arr1)
arr2(arr1(i, 1), 2) = arr1(i, 2)
Next

Where arr1 is the one you showed in this post.

RBS

"Ozz" wrote in message
...
I have a query in Access which results I put into a two dimensional array
in
Excel through ADO.

The array has the columns month & count.
What I would like to do is place the results in a worksheet neatly putting
the count of month 5 in the cell for month 5.

Only problem is, when there is no count in month 5, it is not shown in the
query.
So if the query results a

Month: Count
1: 50
2: 29
3: 11
4: 40
6: 30

It misses month 5. On the worksheet, month 5 should be displayed as 0.

I've tried Vlookup but that didn't work.
How do I do this?


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
find each of the items in an array and save result in another array lif[_5_] Excel Programming 2 June 28th 06 01:54 AM
waiting Query result Paolo9001 Excel Programming 1 May 23rd 06 11:42 AM
Replace ^ in web query result Don Guillett Excel Worksheet Functions 0 April 26th 06 03:42 PM
Replace ^ in web query result Don Guillett Excel Programming 0 April 26th 06 03:05 PM
Importing result from Access query to Excel but the result only c. Edwin Excel Discussion (Misc queries) 0 March 16th 06 01:36 AM


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