Refer to Elements in an array

D

Derick

I have a dynamic array whcih would be redimed to hold
values in 20 rows and four columns TestArray(1 to 20, 4)

How can I refer to the array so that the contents of a row
in the array be sent to the worksheet.
For example Range("A1:D1") = TestArray(1,4)

Derick
 
T

Tom Ogilvy

Sub AAYY()
Dim varr As Variant
varr = Worksheets("Sheet1").Range("M5:p25").Value
Worksheets("Sheet2").Range("A1:D1").Value = Application.Index(varr, 1, 0)
End Sub
 
D

Derick Hughes

Thanks Tom,
I am now trying to work further with the elements of the array.
I am trying to count the number of instances a value occurs in the array
with this statement. However it produces a run time error '424' Object
required.
countNum is declared as a variant.
CountNum =
Application.WorksheetFunction.CountIf(Application.WorksheetFunction.Inde
x(varr, 1, 0), 1)


Regards
Dk

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

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