+ Reply to Thread
Results 1 to 4 of 4

#REF error not exported as text from Excel to txt with VBA

  1. #1
    Registered User
    Join Date
    11-03-2015
    Location
    Croatia
    MS-Off Ver
    2010
    Posts
    1

    #REF error not exported as text from Excel to txt with VBA

    Hi,

    I am exporting data from an Excel spreadsheet to txt with the following code:
    Please Login or Register  to view this content.
    The sheet contains various formulas but for one or another reason the code is not working when the formulas show a #REF error (I am expecting that this value is exported as simple text).

    Any ideas what could be the reason?

    Many thanks!
    Last edited by Leith Ross; 11-08-2015 at 02:39 PM. Reason: Added Code Tags

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: #REF error not exported as text from Excel to txt with VBA

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: #REF error not exported as text from Excel to txt with VBA

    Hello kavond,

    Welcome to the Forum!

    #REF is the text that Excel displays to indicate the cell contains an error. VBA also sees this an error but instead of displaying #REF, it displays the Excel error value of 2023.

    You can get the text representation of a cell in VBA by using the Text property. Read the individual cell Text properties into a 2-D array and then format the array.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: #REF error not exported as text from Excel to txt with VBA

    Alternatively you can use error handing in your formulas on the sheet like IFERROR(<Your Formula Here>,"") to show blank where your formulas return an error or IFERROR(<Your Formula Here>,"#Ref!") to show #Ref! error as a text. In both the cases your code should work fine.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

+ 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. [SOLVED] Using a cells text as part of an Exported Wb name?
    By mrshl9898 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-28-2015, 12:52 AM
  2. [SOLVED] How to convert exported text date to desired date format with excel vba.
    By sktneer in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 10-03-2013, 01:08 AM
  3. [SOLVED] error opening Excel 2010 file exported from web app
    By janmcconnell in forum Excel General
    Replies: 1
    Last Post: 09-06-2012, 05:55 PM
  4. Replies: 0
    Last Post: 05-20-2009, 05:37 AM
  5. [SOLVED] Need quotes around exported tab delimited text
    By Carol Grismore in forum Excel General
    Replies: 0
    Last Post: 05-17-2006, 01:25 PM
  6. Dates exported as text
    By michael.a7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2006, 09:04 AM
  7. [SOLVED] why are there quotes in my exported text file?
    By AlexK in forum Excel General
    Replies: 2
    Last Post: 02-16-2005, 03:04 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