+ Reply to Thread
Results 1 to 7 of 7

Ignore Type mismatch error

  1. #1
    Registered User
    Join Date
    10-24-2007
    Posts
    37

    Ignore Type mismatch error

    I was trying to write data from Excel to an output file. It works fine, except if there are no values in a cell with an embedded formula. Is there VB code that I could add to the macro, so that it would ignore the #N/A error in the cell and continue writing data from cells that contain data only? thanks

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

    You could trap the specific error using either the On Error GoTo or On Error Resume Next statement. Most likely you can avoid generating an error at all. Either way, you should post your code.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    10-24-2007
    Posts
    37
    Thanks, Leith Ross.
    Here is the code:
    Please Login or Register  to view this content.

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

    Where are you getting the "N/A" error? That is worksheet formula error.

    Sincerely,
    Leith Ross

  5. #5
    Registered User
    Join Date
    10-24-2007
    Posts
    37
    As you see in the attachment, the #N/A error was coming from the formula (see below) in that worksheet cell.
    Please Login or Register  to view this content.
    I wanted to continue writing data, even if there is no data in a cell.
    Attached Files Attached Files

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

    Actually, I don't see any formulas anywhere in your attachment. This is all very confusing. If you want to get an answer to problem, post your complete workbook for review.

    Sincerely,
    Leith Ross

  7. #7
    Registered User
    Join Date
    10-24-2007
    Posts
    37
    I used the On Error GoTo and it worked fine. Thanks for the tip.

+ 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