View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Roger Whitehead[_4_] Roger Whitehead[_4_] is offline
external usenet poster
 
Posts: 29
Default Extracting info from a database

Hi David, try this (Untested):

Private Sub extract()

Dim descript(7) as String
Dim I As Double
I = 1013

descript(0) = WorksheetFunction.VLookup(I, Range("itemlist!Database"), 2)
Debug.Print descript

descript(1) = WorksheetFunction.VLookup(I, Range("itemlist!Database"), 3)
Debug.Print descript

descript(2) = WorksheetFunction.VLookup(I, Range("itemlist!Database"), 4)
Debug.Print descript
'......etc

'to descript(7)
End Sub



Alternatively type "Option Base 1" in the decalrations section of the
module; the Array elements will then be (1) to (8)


--
HTH
Roger
Shaftesbury (UK)



"J David Southwick" wrote in message
...
Private Sub extract()
Dim I As Double
I = 1013
descript = WorksheetFunction.VLookup(I, Range("itemlist!Database"), 2)
Debug.Print descript
descript = WorksheetFunction.VLookup(I, Range("itemlist!Database"), 3)
Debug.Print descript
descript = WorksheetFunction.VLookup(I, Range("itemlist!Database"), 4)
Debug.Print descript
'......etc
End Sub

What I want to do is extract all the information pertaining to "I" ,which
fills 8 columns, with code that will bring it into code as an array.
I know how to send an array to a worksheet but can not find any examples

on
how to populate the array from a worksheet.(In this case, my database)

Thanks very much

Dave