+ Reply to Thread
Results 1 to 9 of 9

Absolute Value -- Error type mismatch

  1. #1
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Absolute Value -- Error type mismatch

    Hi all,

    I am running a macro that classifies exclusions in a data set. Everything works fine except one thing. I am checking to see if the value in a set column is greater than 3, if so I want it to set the exclude value to 4. I have similar things written for all of the other checks, but the difference with this column is that it is an absolute value calculation. The code for this section is below. It returns error type mismatch

    Please Login or Register  to view this content.
    Any help would be appreciated!

    Thanks,
    Scott
    Last edited by sokeefe14; 05-18-2015 at 11:40 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Absolute Value -- Error type mismatch

    Scott

    Which line of code is the error occurring on?

    Also what do you mean by an 'absolute value calculation'.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Absolute Value -- Error type mismatch

    The error is on the first line of the if statement.
    Absolute value calculation in the column. So the column its checking for values > 3 (rm.column), has a formula in each cell that says =Abs((S2-AG2)/S2). So what I want the code to do is check if that value is > 3, and if so put a 4 in the exclude column. The reason I think it has something to do with absolute value is because I have a similar check on the cell next to it that works fine and the cells it is checking are a simp

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Absolute Value -- Error type mismatch

    If your calculation returns a number, absolute or not, it won't cause a mismatch.

    Things that can cause mismatches are text values and errors in a cell.

    Have you checked what the actual value of ActiveSheet.Cells(i, rm.Column).Value is when you get the error?

  5. #5
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Absolute Value -- Error type mismatch

    How do I do that? I am looking at all the cells in that column and they all show numbers.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Absolute Value -- Error type mismatch

    Can you upload a sample workbook?

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

  7. #7
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Absolute Value -- Error type mismatch

    Unfortunately I cannot do that, the data is sensitive.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Absolute Value -- Error type mismatch

    Are you sure you don't have any numbers stored as text?

    Is the code definitely being run against the correct sheet in the correct workbook?

    Do you have any headers?

  9. #9
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Absolute Value -- Error type mismatch

    I figured it out. There were filtered cells that had a div/0 error so I had to adjust accordingly. Thank you for your help.

+ 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. Run Type error 13 Type Mismatch
    By Affan Khan in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-13-2012, 12:58 PM
  2. [SOLVED] Run-type error 13 type mismatch
    By misop in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-05-2012, 04:08 AM
  3. Complile Error: Type Mismatch ??? After adding error trap
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2012, 03:50 PM
  4. Conditional Formatting - Run Time Error '13' Type Mismatch Error
    By ksp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-17-2011, 07:37 PM
  5. [SOLVED] Help: Compile error: type mismatch: array or user defined type expected
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2005, 05:05 PM

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