Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jul 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For some reason, the MID statement is not pulling from this string in my spreadsheet cell A1:
    id█asset_number█standard_item_description█normal_s tate█phase█phase

    I used this message box to return the value specified in the statement below, but the message box shows no values. It should show the first 8 characters, but is empty. Any reason why this would be empty? I am trying to do a text to columns and specify if it should delimite by ^ or █ based on the files structure.

    Dim Delim As String
    Delim = Mid(A1, 1, 8)
    MsgBox (Delim)


    The message box is empty.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    [quote name='msstein' post='763692' date='05-Mar-2009 10:55']For some reason, the MID statement is not pulling from this string in my spreadsheet cell A1:[/quote]
    I rarely write Excel code, but are you sure you can refer to a cell as A1 without anything else? If you do not already use Option Explicit at the top of all your code modules, try adding that and see whether you get a compile error on an undeclared variable named A1.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The code assumes that A1 is a variable, not a cell. To refer to cell A1, use either

    Delim = Mid(Range("A1"), 1, 8)

    or

    Delim = Mid([A1], 1, 8)

Posting Permissions

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