Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 4 Dec, 16:41, "Per Jessen" wrote:
Hi When you are assigning data to your array the first field in the array will have index number 0. If you want to make first index = 1 put this line at the top of your code (outside the sub): Option Base 1 Regards, Per I have a code that I think is the problem and I have no idea on how arrays or even invert arrays work - here is the code: Dim TaskData() As Variant Call LastRow TaskData() = Sheets("New Time Sheet").Range("A12:L" & LastR).Value 'TaskData() = Sheets("New Time Sheet").Range("A12:L12").Value Dim Tempdata() As Variant c = 0 For a = 1 To (LastR - 11) Step 1 'For a = 1 To 21 Step 1 'If TaskData(a, 11) = "" Then If TaskData(a, 12) = "" Then Else c = c + 1 ReDim Preserve Tempdata(12, c) ''For d = 1 To (LastR - 11) Step 1 For d = 1 To 12 Step 1 Tempdata(d, c) = TaskData(a, d) Next d End If Next a '-----invert array----- ReDim TaskData(c, 12) For a = 1 To c Step 1 For b = 1 To 12 Step 1 TaskData(a, b) = Tempdata(b, a) Next b Next a- Hide quoted text - - Show quoted text - Hi I have entered the code outside of the Sub and when I run it I get Error 9 Subscript out of range?? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Array Problem | Excel Discussion (Misc queries) | |||
VBA array problem | Excel Programming | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
array use problem | Excel Programming |