+ Reply to Thread
Results 1 to 5 of 5

Discern deafult values from assigned values of Integer, Long, Double, String

  1. #1
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    Discern deafult values from assigned values of Integer, Long, Double, String

    Hello Dear Excel Help

    I'm trying wrap my mind around types in VBA. Is there definitive guide or table?
    For each type I need to discern uninitialized state (no value supplied that means default value) from state when default value is explicitly supplied to variable.
    That means:

    1a) Dim int As Integer
    vs
    1b) Dim int As Integer
    int=0

    Another problem is with arrays for each type I need to discern states:
    2a) Dim int() As Integer
    vs
    2b) Dim int() As Integer
    Redim int(1 To 10)
    2c) Dim int() As Integer
    Redim int(1 To 10)
    int(1)=0

    In 2c) I need to discer states int(1) vs int(2).

    I know for Variant array I can use IsEmpty and C. Pearson gives IsArrayEmpty function which can check whether array of all types was dimensioned or not.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Discern deafult values from assigned values of Integer, Long, Double, String

    Think this covers it: http://www.quepublishing.com/article...39929&seqNum=2
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    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: Discern deafult values from assigned values of Integer, Long, Double, String

    There's no way to discern whether the default value of a simple scalar variable is there by default or assignment.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    Re: Discern deafult values from assigned values of Integer, Long, Double, String

    Quote Originally Posted by shg View Post
    There's no way to discern whether the default value of a simple scalar variable is there by default or assignment.
    Ok, I take it. You saved me lot of pain. I don't have to try it anymore. I will use Variant type when needed.

    Should I close this thread as solved or should I wait some time before closing it?

  5. #5
    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: Discern deafult values from assigned values of Integer, Long, Double, String

    As you choose.

+ 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. Replies: 2
    Last Post: 05-17-2016, 11:17 AM
  2. [SOLVED] vba to re assigned column values from master into newsheet with new header values
    By johnmacpro in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-10-2016, 06:40 AM
  3. [SOLVED] Transpose a long column into delimiters separated values according to values in input box
    By prkhan56 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-27-2014, 01:32 PM
  4. Extract values from long string
    By s@skia in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 03-13-2014, 12:32 PM
  5. descriminate string(letters) values from integer/long (number) values
    By ag273n in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-21-2013, 03:12 AM
  6. Replies: 1
    Last Post: 01-14-2013, 04:01 AM
  7. Replies: 5
    Last Post: 11-08-2012, 03:38 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