+ Reply to Thread
Results 1 to 5 of 5

Type Mismatch when trying to offset from user selected value

  1. #1
    Registered User
    Join Date
    10-08-2014
    Location
    Blacksburg, Virginia
    MS-Off Ver
    2013
    Posts
    18

    Type Mismatch when trying to offset from user selected value

    I am trying to display a users information based off of a user ID that they select, and then display corresponding information in text boxes on a form. I can display the user selected ID number but am having trouble using an offset function to display the rest of the information and keep getting a type mismatch error. Any thoughts?

    This is my code where txtActID and txtDescription are both text boxes on a form. The txtActID displays the correct value but it is the txtDescription line where I am getting the type mismatch error.

    Please Login or Register  to view this content.
    Last edited by cmurda; 11-06-2014 at 10:08 PM.

  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

    Re: Type Mismatch when trying to offset from user selected value

    Hello cmurda,

    You need to check that Application.Match has not returned an error before you proceed in your code.

    Assign the return value to a Variant type varaible and check it like this...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    10-08-2014
    Location
    Blacksburg, Virginia
    MS-Off Ver
    2013
    Posts
    18

    Re: Type Mismatch when trying to offset from user selected value

    Leith Roth,

    Thank you for your input! It seems that there is an error with my match function. I don't quite understand why though, I've done something very similar in another program I was writing and didn't have any issues with it, however for some reason I can't seem to transfer it to this program. Do you have any thoughts about what the problem could be or where it might be coming from?

    Thanks!

    Cmurda

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

    Re: Type Mismatch when trying to offset from user selected value

    As is, r3 is only one cell.
    Please Login or Register  to view this content.
    Ben Van Johnson

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

    Re: Type Mismatch when trying to offset from user selected value

    Hello

    You can check the Ret value and see which error you have encountered. Just remove the IsError() from around Ret.

    Place your cursor on the code line and press F9. This will place a breakpoint in your code. The code will stop at this line and you an see the value of Ret.
    Please Login or Register  to view this content.

+ 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. macro to allow user to type in one selected drop down for- "other".
    By mteeters in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-15-2012, 12:48 PM
  2. 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
  3. [SOLVED] Type Mismatch: array or user defined type expected
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2006, 10:45 AM
  4. [SOLVED] Type mismatch using rnge as Range with Type 8 Input Box
    By STEVE BELL in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-03-2005, 01:10 AM
  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

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