+ Reply to Thread
Results 1 to 8 of 8

VBA: locating any error cells in a given column

Hybrid View

niceguy21 VBA: locating any error cells... 04-25-2013, 11:03 AM
JosephP Re: VBA: locating any error... 04-25-2013, 11:12 AM
niceguy21 Re: VBA: locating any error... 04-25-2013, 11:22 AM
JosephP Re: VBA: locating any error... 04-25-2013, 11:28 AM
niceguy21 Re: VBA: locating any error... 04-25-2013, 11:39 AM
JosephP Re: VBA: locating any error... 04-25-2013, 11:46 AM
niceguy21 Re: VBA: locating any error... 04-25-2013, 11:52 AM
JosephP Re: VBA: locating any error... 04-25-2013, 11:56 AM
  1. #1
    Forum Contributor
    Join Date
    06-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    106

    VBA: locating any error cells in a given column

    I have attempted this piece of code, but I am little confused as to the syntax for the IsError() function.

    Any assistance would be helpful!

    Sub Macro9()
    Dim LReturnValue As Boolean
    
    LReturnValue = IsError(Sheets("Lookup Addition").Range("A:A").Value)
    
    If LReturnValue = FALSE Then
    
    i = MsgBox("there were no errors", vbOKOnly)
    
    Else
    
    i = MsgBox("there were errors", vbOKOnly)
    
    End If
    
    End Sub

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA: locating any error cells in a given column

    iserror does not work with an array or multiple-cell range but you can use
    Sub Macro9()
    Dim rErrors as Range
    on error resume next
    set rerrors = Sheets("Lookup Addition").Range("A:A").SpecialCells(xlCellTypeFormulas, xlerrors)
    if rerrors is nothing then
    
    i = MsgBox("there were no errors", vbOKOnly)
    
    Else
    
    i = MsgBox("there were errors", vbOKOnly)
    
    End If
    on error goto 0
    End Sub
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    06-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: VBA: locating any error cells in a given column

    Quote Originally Posted by JosephP View Post
    iserror does not work with an array or multiple-cell range
    unfortunately, when I place a vlookup in column A that evaluates to an error, the "there were errors" prompt does not come up when I run the macro; the other one comes up instead

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA: locating any error cells in a given column

    care to post a sample? the code works for me

  5. #5
    Forum Contributor
    Join Date
    06-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: VBA: locating any error cells in a given column

    Quote Originally Posted by JosephP View Post
    care to post a sample? the code works for me
    https://dl.dropboxusercontent.com/u/69651453/Book3.xlsm

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA: locating any error cells in a given column

    wrong sheet name-you need
    Sheets("Lookup Addition ")
    and not
    Sheets("Lookup Addition")
    ;-)

  7. #7
    Forum Contributor
    Join Date
    06-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: VBA: locating any error cells in a given column

    Quote Originally Posted by JosephP View Post
    wrong sheet name-you need
    Sheets("Lookup Addition ")
    and not
    Sheets("Lookup Addition")
    ;-)

    arrgggggggggggghhhhhhh!!!!!!!!!!!!!!!

    btw what does the on error go to zero achieve here?

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA: locating any error cells in a given column

    nothing-I wasn't sure if that was really the end of your actual sub so I thought I'd add it just in case

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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