Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default length of an array

is there any command (like in java) which gives you the length of an array?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default length of an array

Lookup UBound in the VBA help.

Dim Arr(1 to 100) as String

MsgBox UBound(Arr)

This will give 100

RBS

"april27" wrote in message
...
is there any command (like in java) which gives you the length of an
array?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default length of an array

Use

UBound(Arr) - LBound(Arr) + 1

in case it doesn't start at 1.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RB Smissaert" wrote in message
...
Lookup UBound in the VBA help.

Dim Arr(1 to 100) as String

MsgBox UBound(Arr)

This will give 100

RBS

"april27" wrote in message
...
is there any command (like in java) which gives you the length of an
array?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default length of an array

a more general determination for a single dimension:

Dimensionsize = Ubound(a) - lbound(a) + 1

--
Regards,
Tom Ogilvy

"RB Smissaert" wrote:

Lookup UBound in the VBA help.

Dim Arr(1 to 100) as String

MsgBox UBound(Arr)

This will give 100

RBS

"april27" wrote in message
...
is there any command (like in java) which gives you the length of an
array?



Reply
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
Modify array function length Fabian Grodek Excel Worksheet Functions 3 August 8th 06 04:45 PM
how do I do a variable length array based on the value in a cell Mark Pranger Excel Discussion (Misc queries) 1 January 25th 06 07:01 AM
array length in VBA itsmaheshp[_4_] Excel Programming 1 November 9th 04 01:08 PM
Array Length. Tom Ogilvy Excel Programming 0 July 21st 04 03:59 PM
Array Length. Norman Jones Excel Programming 0 July 21st 04 03:56 PM


All times are GMT +1. The time now is 02:10 AM.

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"