Excel 2010 VBA Tutorial 24 - looping through a multi dimensional array

preview_player
Показать описание
How to use nested for loops to loop through a multi-dimensional array.
Рекомендации по теме
Комментарии
Автор

I would watch the rest of the series, at this point in time it is still teaching the basics that you need to be able to make practical use of VBA. I would disagree with functions being more efficient without the code. Most of the time it is only more efficient for the programmer and not the end user. Thanks for your feedback though I will take on board what you have said and will try to incorporate maybe a practical example once every 5 videos as something to recap and add context.

YourprogrammingnetworkCoUk
Автор

Thanks for your great tutorial videos, I am learning it.

leolane
Автор

Hi, How about populating an array Row across all Dimensions in 1 go. E.g. in Matlab, you can do this with Array(5, :) = [ x y z ], Can this be done in VBA, to make the coding quicker or less repetitive on assigning each value in a double loop?

Javbo
Автор

Hello,
If we want to fill in the array with integers(or doubles) what do we need to change(except the definition of the variables)?

Vg-k
Автор

Hi Matty, hope you could see my question. I got a runtime 13 type mismatch error by typing in the exact same code as you in this tutorial. I'm using excel 2011 in Mac. Could you tell me how to fix it? Thanks!

fizzi
Автор

Hello, I only get 5*5 column and row filled according to your codes. The test environment is Mac office 2016.

MarkWang
Автор

Hello, just a quick question as this is the second time I have wondered.

Is there a difference between a) what you had done in the video: storing the desired values in an array first and then pass them onto the spreadsheet with another loop. and b) storing the values straight in the correct cells in the spreadsheet with one loop.

Thanks

darrenxys
Автор

Thanks for these videos. So, this was the first time I think you used Lbound. Is that the opposite of Ubound?

So does it do the same thing as saying :

For x = 0 to 9

But if you use LBound and UBound you don't need to know the actual numbers:

For x = LBound (MySexyArray, 1) to UBound(MySexyArray, 1)

Have I got it right?

RichGillett
Автор

Just wondering why you used two separate "for x " statement rather than just one, couldn't you have put the printing commands within the first "for x" statement?

oshannel
Автор

Hi! thanks for your videos, they are really useful!!
Anyway, I can never understand what I should use, "as double", "as integer" etc, is there any rule??
thanks!

gloriacaride
Автор

Great tutorials, but sometimes your code is a bit inefficient.
Could have used:
For x = LBound(myArray, 1) To UBound(myArray, 1)
For y = LBound(myArray, 2) To UBound(myArray, 2)
myArray(x, y) = "x= " & x & ", y= " & y
+ 1, y + 1) = myArray(x, y)
Next y
Next x

Instead of another for loop

saizen
Автор

These videos are great, but I don't see an incredible amount of practical use thus far through the series. It seems to be doing functions that could more efficiently be done without typing out the code. Granted, I haven't worked through the whole series yet, but I still would prefer applying these techniques to actual spreadsheets with data.

johnschmelzer