+ Reply to Thread
Results 1 to 4 of 4

Assign Data Type to Array Dimension

  1. #1
    Forum Contributor
    Join Date
    08-25-2014
    Location
    Pennsylvania, US
    MS-Off Ver
    Windows '16
    Posts
    165

    Assign Data Type to Array Dimension

    Hi, I have a 2D array, (1 to 50, 1 to 3) let's say. It is initialized in a single statement which copies from a worksheet. Is there a way to define the data type for each dimension of the array? For example (1 to 50, 1) is currency, (1 to 50, 2) is a string, and (1 to 50, 3) is a long. Thanks

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Assign Data Type to Array Dimension

    I do not think so. Data should be the same type in an array. You can use variant data type which is the same as defining both types as the same.

  3. #3
    Forum Contributor
    Join Date
    08-25-2014
    Location
    Pennsylvania, US
    MS-Off Ver
    Windows '16
    Posts
    165

    Re: Assign Data Type to Array Dimension

    Gotcha. Thanks

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Assign Data Type to Array Dimension

    You can only read a multicell range into a Variant. When you do that, each element will take on a subtype of Empty, Error, String, Boolean, or a numeric type.

    If the array is assigned using the Value property, the numeric subtype will be Double, Currency, or Date, according to the cell format.

    If the array is assigned using the Value2 property, the numeric subtype will always be Double.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. The specified dimension is not valid for the current chart type - problem!
    By Matcham in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2016, 07:08 AM
  2. the specified dimension is not valid for the current chart type Error Message
    By bouncingbudha in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-16-2015, 01:21 AM
  3. Can i add another dimension to my variant array and store additional data?
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2012, 12:29 PM
  4. Does filling part of an array from a range re-dimension the array?
    By barryleajo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-04-2011, 10:09 AM
  5. Consolidate data in an 2-dimension array in VBA
    By Huyeote in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2005, 03:05 AM
  6. Mutli-dimensional Array to Single-Dimension Array
    By Blue Aardvark in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2005, 05:05 AM
  7. HOW TO ASSIGN 2 DIMENSION ARRAY VALUES FROM 2 COLUMNS?
    By -JEFF- in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2005, 01:05 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1