Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 5 of 5

Thread: Number of dimensions of an array

  1. #1
    Join Date
    30th July 2004
    Posts
    2

    Number of dimensions of an array

    How can I check number of dimesions of an array? Thanks.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    15th April 2003
    Location
    USA
    Posts
    7,354
    Welcome to the OzGrid Forum!

    Can you elaborate on your question. Do you mean a worksheet array passed to a VBA routine and you want to know the number of rows and columns in the array? Or you have a variant variable in VBA and you want to know how many entries it contains? Or a dimensioned variable is being passed to another routine and you want to determine how many dimensions it was given? Or ...?

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    30th July 2004
    Posts
    2
    Quote Originally Posted by Derk
    Welcome to the OzGrid Forum!

    Can you elaborate on your question. Do you mean a worksheet array passed to a VBA routine and you want to know the number of rows and columns in the array? Or you have a variant variable in VBA and you want to know how many entries it contains? Or a dimensioned variable is being passed to another routine and you want to determine how many dimensions it was given? Or ...?
    What I meant is suppose I write a UDF
    Function MultiNomial(Probs as variannt) as variant

    'Here I check the vaue of probs that user entered. he may enter either
    'a "Range" or a "String" or a "Double" or an "Array()". If he enters an
    'array it could be either One dimensional or two dimensional.
    'How can I check Whether it is one or two dimensional?

    Multinomial=...
    End function

    Mahindajayadev

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    7th February 2003
    Location
    Kewarra Beach, Cairns - TNQ
    Posts
    1,055
    M,

    If your function comes from a worksheet range it will always be 2 dimensional range.

    The followuing code will return 1 for a single dimension array and will return the number of columns in a 2D array.

    VB:
    Sub HowBig() 
        Dim myArray As Variant 
         'myArray = Array("1", "2", "3", "4")
        myArray = Selection.Value 
        On Error Goto sng 
        x = UBound(myArray, 2) 
        MsgBox (x) 
        Exit Sub 
    sng: 
        MsgBox ("1") 
    End Sub 
    
    
    Regards
    Weasel
    Kind Regards
    Pesky Weasel
    "I have a plan so cunning, you could put a tail on it and call it a Weasel." EB
    Eagles may soar, but Weasels don't get sucked into jet engines.
    Templates and Calculators
    The Way of the Weasel
    Download Ivan & Colo's HTML Maker Here
    101 Excel Hacks - Great New Book
    Huge Savings on Excel Training

  5. #5
    Join Date
    20th August 2003
    Location
    Finland
    Posts
    97

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Get Array Dimensions
    By ajingham in forum EXCEL HELP
    Replies: 5
    Last Post: July 4th, 2007, 15:08
  2. Screen dimensions in pixels
    By Ger Plante in forum EXCEL HELP
    Replies: 2
    Last Post: July 19th, 2005, 01:18
  3. Axis Dimensions
    By jpw4134 in forum EXCEL HELP
    Replies: 6
    Last Post: July 16th, 2005, 09:39
  4. Replies: 2
    Last Post: July 12th, 2005, 21:37
  5. Charts : plotting more than 3 dimensions
    By compaq in forum EXCEL HELP
    Replies: 1
    Last Post: March 22nd, 2004, 18:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
porno