+ Reply to Thread
Results 1 to 3 of 3

Preventing Date Conversion from Text

  1. #1
    Registered User
    Join Date
    03-28-2012
    Location
    Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Preventing Date Conversion from Text

    Hi,

    I am having an issue with text being converted to a date when I need to keep the text.

    Background : I have created a form with two ComboBoxes, one which contains the name of all open workbooks, that is loaded during initialization, and the other that is loaded with Worksheet names of any selected workbook - loaded when the first ComboBox chages.

    When loading the woeksheet ComboBox, I first create an array with all the worksheet names and then sort them, moving them to a range on a spare worksheet and rng.sort, before moving back to the array and loading the ComboBox.

    Issue : This works well most of the time, but if the workbook contains Sheet names such as "Oct 20011", "Dec 2011" then when I copy the array to the range (rng = Application.Transpose(WSarray) in the code below), the text is converted to a date value. So when my ComboBox is displyed it contains "01.10.2011" and "01.12.2011" instead of the correct names.

    Is there any way to prevent the "Oct 2010", etc. being converted to a date?

    For information, the code is below (the workbook name is in ComboBox "cbWkBk")

    Please Login or Register  to view this content.
    Edit : "Control" just disables/enables screen updating and autocalculation.
    Last edited by mirfield; 03-28-2012 at 10:06 AM. Reason: Clarify "Control"

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Preventing Date Conversion from Text

    Try

    Please Login or Register  to view this content.
    in order to force a text value.
    Martin

  3. #3
    Registered User
    Join Date
    03-28-2012
    Location
    Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Preventing Date Conversion from Text

    Gah! The simple fixes are the best.

    That works perfectly. Thank you.

+ 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