+ Reply to Thread
Results 1 to 2 of 2

Error Table For Excel Comparisons

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-22-2004
    Location
    Kokomo, Indiana
    Posts
    236

    Question Error Table For Excel Comparisons

    This is a toughy I believe. For the past few weeks my evenings are learning and working on a large macro to compare and verify correct use of data in two spreadsheets within the same workbook. What I'd like to do is create a lookup table which has my error messages in it. To go along with the error messages its important to plant what the error is. Example below:

    Error Table -

    Error 1: A, Cell B = C, Value is greater than 90
    Error 2: A, Cell B = C, Value is less than 50
    ....
    ....
    .... etc. - where A=sheet name, B=Cell and C= value in Cell

    Listing reports error in log for error 1 (text file) below:

    Error 1: Sheet1, Cell A1 = 91, Value is greater than 90

    Am I making this more complex than it really is?


    Learning VBA quickly and enjoying it......

    Tony

  2. #2
    Bernie Deitrick
    Guest

    Re: Error Table For Excel Comparisons

    Personally, I would create the error message on the fly, as the comparisons are made. For example,
    with your first two messages:

    For Each mySht In ActiveWorkbook.Worksheets
    For Each myCell In mySht.Range("A1:A100")
    If myCell.Value > 90 Then
    strErrMsg = mySht.Name & ", Cell " & _
    myCell.Address(False, False) & _
    " = " & myCell.Value & _
    ", Value is greater than 90"
    MsgBox strErrMsg
    ElseIf myCell.Value < 50 Then
    strErrMsg = mySht.Name & ", Cell " & _
    myCell.Address(False, False) & _
    " = " & myCell.Value & _
    ", Value is less than 50"
    MsgBox strErrMsg
    End If
    Next myCell
    Next mySht

    HTH,
    Bernie
    MS Excel MVP


    "ajocius" <ajocius.1ss2qo_1122383185.9983@excelforum-nospam.com> wrote in message
    news:ajocius.1ss2qo_1122383185.9983@excelforum-nospam.com...
    >
    > This is a toughy I believe. For the past few weeks my evenings are
    > learning and working on a large macro to compare and verify correct use
    > of data in two spreadsheets within the same workbook. What I'd like to
    > do is create a lookup table which has my error messages in it. To go
    > along with the error messages its important to plant what the error is.
    > Example below:
    >
    > Error Table -
    >
    > Error 1: A, Cell B = C, Value is greater than 90
    > Error 2: A, Cell B = C, Value is less than 50
    > ...
    > ...
    > ... etc. - where A=sheet name, B=Cell and C= value in Cell
    >
    > Listing reports error in log for error 1 (text file) below:
    >
    > Error 1: Sheet1, Cell A1 = 91, Value is greater than 90
    >
    > Am I making this more complex than it really is?
    >
    >
    > Learning VBA quickly and enjoying it......
    >
    > Tony
    >
    >
    > --
    > ajocius
    > ------------------------------------------------------------------------
    > ajocius's Profile: http://www.excelforum.com/member.php...o&userid=17695
    > View this thread: http://www.excelforum.com/showthread...hreadid=390162
    >




+ 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