ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting excel array dimension (https://www.excelbanter.com/excel-programming/300715-getting-excel-array-dimension.html)

banavas[_3_]

Getting excel array dimension
 
Dear Friends,

when having a excel sheet with values from a1 to c5, is it possible to
get the dimensions of the 2-dim array without counting?

Thanks,
Georgios


---
Message posted from http://www.ExcelForum.com/


AA2e72E[_2_]

Getting excel array dimension
 
All Excel ranges have a rows and columns property; these are effecively your dimensions

e.

?range("c4:f19").rows.coun
16
?range("c4:f19").columns.coun
4
You have to take care when indexing i.e. allow for option base.

banavas[_4_]

Getting excel array dimension
 
~× wrote:
*All Excel ranges have a rows and columns property; these ar
effecively your dimensions.

e.g

?range("c4:f19").rows.count
16
?range("c4:f19").columns.count
4
You have to take care when indexing i.e. allow for option base. *


Yes that is clear. The question though arised from the fact that when
pivot table is to be created with the wizard, Excel magically enoug
automatically selects the range that appears on the sheet when only on
cell of the range is selected.
That means that it can found the U & L bounds of the range.

In my application the input range may vary in terms of dimensions and
want to avoid manually to select, give or calculate the dimensions o
my range.

Thanks,
Georgio

--
Message posted from http://www.ExcelForum.com


JE McGimpsey

Getting excel array dimension
 
One way:

?Range("C4").CurrentRegion.Rows.Count

?Range("C4").CurrentRegion.Columns.Count

In article ,
banavas wrote:

Yes that is clear. The question though arised from the fact that when a
pivot table is to be created with the wizard, Excel magically enough
automatically selects the range that appears on the sheet when only one
cell of the range is selected.
That means that it can found the U & L bounds of the range.

In my application the input range may vary in terms of dimensions and I
want to avoid manually to select, give or calculate the dimensions of
my range.



All times are GMT +1. The time now is 08:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com