Thread: Array Values
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Paul Robinson Paul Robinson is offline
external usenet poster
 
Posts: 208
Default Array Values

Hi
Your request is a bit vague, but I'll assume you want to populate
Wheel with the none empty values in your range. You will first of all
check that your range is not empty.
One way of many might be

Dim MyRange as Range
Set MyRange = Worksheets("MyWorkSheet").Range("A1:AP1")
ict = Application.Worksheetfunction.CountA(MyRange)
Dim Wheel()
If ict=0 then
MsgBox "There are no values!"
Else
ReDim Wheel(0 to ict-1)
Dim j as integer, i as integer
i = 0
With MyRange
For j = 1 to .Columns.Count
If .Cells(1, j).Value<"" then
Wheels(i) = .Cells(1, j).Value
i = i+1
end if
next j
end with
end if

regards
Paul

Michael168 wrote in message ...
I declare a dynamic array but don't know how to assign the cells.value
to the wheel
I use columns A1:AP1 to let the user key in each individual number.
From the range that have numbers, I use the counter as array size.
e.g

Sub Lwheel()

ict = WorksheetFunction.CountA(Range("A1:AP1"))
Dim wheel()
Redim Wheel(0 To ict)

Example the user key in A1=1,A2=2,A3=3,A4=4,A5=5,A6=6,A7=7,A8=8

So the array becomes as below;

Wheel(0)=A1 # 1
Wheel(1)=A2 # 2
Wheel(2)=A3 # 3
Wheel(3)=A4 # 4
Wheel(4)=A5 # 5
Wheel(5)=A6 # 6
Wheel(6)=A7 # 7
Wheel(7)=A8 # 8

My questions is how to assign the individual cells.value to wheel (0)
until wheel(7)?


End Sub

Regards
Michael


---
Message posted from http://www.ExcelForum.com/