+ Reply to Thread
Results 1 to 4 of 4

#Value! Macro error

  1. #1
    Registered User
    Join Date
    11-27-2013
    Location
    Leeds, England
    MS-Off Ver
    Excel 2010
    Posts
    41

    #Value! Macro error

    I have excel marco running that transfers information from one page to another. Everything is running fine however i have an issue where some people don't fully fill the sheet in. So this morning with the help of this site (YAY!) I have built in to the Macro that if E3 for example is empty it errors and display a message.

    HOWEVER...... In cell H107 I have a calculation that has a running total adding things together and if this is not fully completed I get #VALUE! error which again is fine but again its the small minority that don't fully complete. I want to build a similar IF that if H107 displays #VALUE! it will error and display a message. The code I have written errors when I test it. HELP!!!

    If Range("H107").Value = "#VALUE!" Then
    MsgBox "Your scoring of this call is incomplete, please recheck ensuring you have completed all the mandatory boxes for this type of call before re-submitting. (This data has not been moved to the Database)"
    Exit Sub
    End If

    VBA highlights the first line and I don't understand why.

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: #Value! Macro error

    If the cell contains an error value you may not compare that to a string. You may either use the .Text property rather than .Value or use an IsError test:
    Please Login or Register  to view this content.
    or:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-27-2013
    Location
    Leeds, England
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: #Value! Macro error

    Cheers, I'll give that ago and report back

  4. #4
    Registered User
    Join Date
    11-27-2013
    Location
    Leeds, England
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: #Value! Macro error

    I used the IsError version and this works. Thank you

+ 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. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  2. [SOLVED] Simple Calendar pop up macro --> error Run-time error '424': Object required
    By am_hawk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2013, 10:38 AM
  3. Print Macro / module error & Update / Clear Macro error
    By mal.b.graham in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-28-2012, 06:40 PM
  4. [SOLVED] Macro error - Run time error 1004 (App defined/Object Defined error)
    By jlax34 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-06-2012, 03:02 PM
  5. Excel Macro Error - Run time error 1004 - Paste method of worksheet class failed
    By kvflynn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2012, 10:51 AM

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