Home > How-To Library > Arrays, Collections, Lists
How to evaluate the total number of elements in a two dimensional array
**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * **************************************************************** Debug.Print LBound(Cells, 1) ' Displays 1, lower index of 1st dimension Debug.Print LBound(Cells) ' Same as above Debug.Print UBound(Cells, 2) ' Displays 20, upper index of 2nd dimension ' Evaluate total number of elements. NumEls = (UBound(Cells) - LBound(Cells) + 1) * (UBound(Cells, 2) - LBound(Cells, 2) + 1)
If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.