Populating an excel list from an Array

T

thiaga

I have an array(Variant) of values.
I would like to show them as a list in the excel worksheet.
How do i do this? I am a newbie!!
 
H

Helmut Weber

Hi Thiaga,

like this, and there is a lot more to it.

It isn't half of the truth!

read this first.
http://word.mvps.org/faqs/interdev/ControlXLFromWord.htm


Sub Macro21()
Dim l As Long
' create an array and fill it
Dim sArr(1 To 10) As String
For l = 1 To 10
sArr(l) = Format(l, "00")
Debug.Print sArr(l)
Next
Dim oExl As Excel.Application
Set oExl = New Excel.Application
oExl.Visible = True
' create a new workbook
With oExl.Workbooks.Add
' fill excel-cells with the values from your array
For l = 1 To 10
oExl.ActiveWorkbook.ActiveSheet.Cells(l, 1).Value = sArr(l)
Next
End With
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top