+ Reply to Thread
Results 1 to 3 of 3

Why might some 'times' be sub-type 5 and some be sub-type 8?

  1. #1
    Chet Shannon
    Guest

    Why might some 'times' be sub-type 5 and some be sub-type 8?

    Anyone have a possible explaination as to why I seem to be getting an
    inconsistent format on a column of times. I am downloading data from a
    active server web page that gives me data in excel format. The data I get is
    various columns of numbers , text and what looks like some times.

    The problem is that in my time column some of the rows are variable sub-type
    5 (vbDouble) and some are variable sub-type 8 (vbString). This is producing
    problems for my code which is expecting all vbString type data.

    In general might someone think of a reason why some times come out type 5
    and some type 8? (Or a good way to convert a cell from having a vbDouble
    value versus a vbString value?)

    I'm stumped at this point but possibly my understanding of how this works is
    lacking.

    Thanks,
    --
    Chet

  2. #2
    JE McGimpsey
    Guest

    Re: Why might some 'times' be sub-type 5 and some be sub-type 8?

    XL cell's .Value property contains either a Double (any numeric value,
    including dates), Text, or an error. Values pasted in from the web often
    get pasted in as Text, especially if they contain non-breaking spaces.
    If they're not interpreted as Text, they'll be parsed, and coerced into
    XL dates (integer offsets from a base date).

    vbString and vbDouble, as their prefixes imply, only apply to VBA
    variables, including any internal temporary variables that are assigned
    properties of the cell(s).

    If you want the string value, you can assign your variable the .Text
    property, which will return a string as displayed in the cell:

    Dim sMyVar As String
    sMyVar = Range("A1").Text


    or, use the Format() method:

    Dim sMyVar As String
    sMyVar = Format(Range("A1").Value, "dd mmm yyyy")





    In article <91A0348E-3EC3-42A5-B95D-6E1BE03A507F@microsoft.com>,
    Chet Shannon <ChetShannon@discussions.microsoft.com> wrote:

    > Anyone have a possible explaination as to why I seem to be getting an
    > inconsistent format on a column of times. I am downloading data from a
    > active server web page that gives me data in excel format. The data I get is
    > various columns of numbers , text and what looks like some times.
    >
    > The problem is that in my time column some of the rows are variable sub-type
    > 5 (vbDouble) and some are variable sub-type 8 (vbString). This is producing
    > problems for my code which is expecting all vbString type data.
    >
    > In general might someone think of a reason why some times come out type 5
    > and some type 8? (Or a good way to convert a cell from having a vbDouble
    > value versus a vbString value?)
    >
    > I'm stumped at this point but possibly my understanding of how this works is
    > lacking.
    >
    > Thanks,


  3. #3
    Myrna Larson
    Guest

    Re: Why might some 'times' be sub-type 5 and some be sub-type 8?

    Perhaps the cells that are type double are in fact recognized as dates, while
    those that are strings are not recognized as such.

    If you show examples of the cells that are numeric and those that are strings,
    somebody will be able to tell you how to convert.


    On Mon, 12 Dec 2005 20:20:01 -0800, Chet Shannon
    <ChetShannon@discussions.microsoft.com> wrote:

    >Anyone have a possible explaination as to why I seem to be getting an
    >inconsistent format on a column of times. I am downloading data from a
    >active server web page that gives me data in excel format. The data I get is
    >various columns of numbers , text and what looks like some times.
    >
    >The problem is that in my time column some of the rows are variable sub-type
    >5 (vbDouble) and some are variable sub-type 8 (vbString). This is producing
    >problems for my code which is expecting all vbString type data.
    >
    >In general might someone think of a reason why some times come out type 5
    >and some type 8? (Or a good way to convert a cell from having a vbDouble
    >value versus a vbString value?)
    >
    >I'm stumped at this point but possibly my understanding of how this works is
    >lacking.
    >
    >Thanks,


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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