LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Array problem

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array Problem Scott Excel Discussion (Misc queries) 4 May 9th 06 05:22 PM
VBA array problem cjsmith22[_7_] Excel Programming 5 November 13th 05 12:32 AM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 6 November 9th 05 05:54 AM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 1 November 8th 05 04:21 AM
array use problem NikkoW Excel Programming 5 May 5th 04 01:32 AM


All times are GMT +1. The time now is 03:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"