Peter.Stevens2
Board Regular
- Joined
- Sep 16, 2008
- Messages
- 56
I'm struggling to explain an error message I'm getting when I step through some code I've written. The code below gets a 'sub script out of range' error and I'm not sure why...
All Arrays are defined correctly and each variable contains the correct values but it wont work. It's made all the more frustrating as Its very similar to some other code I use (different array variables) which works fine! Any help or suggestions would be really useful as my limited knowledge of VBA does not stretch this far! Many Thanks!
Code:
For i = 1 To 16
Workbooks(dataArray(16) & ".xls").Worksheets(dataArray(1)).Cells(1, i).Value = titleArray(i)
Next i
All Arrays are defined correctly and each variable contains the correct values but it wont work. It's made all the more frustrating as Its very similar to some other code I use (different array variables) which works fine! Any help or suggestions would be really useful as my limited knowledge of VBA does not stretch this far! Many Thanks!