Results 1 to 3 of 3

My code is getting a type mismatch error on one workbook, but not the other.

Threaded View

  1. #1
    Registered User
    Join Date
    06-17-2021
    Location
    Washington, USA
    MS-Off Ver
    Current
    Posts
    19

    My code is getting a type mismatch error on one workbook, but not the other.

    EDIT: Figured this out, was labeling the .Column with the wrong number!

    First off, here is a sample of my codes:
    Private Sub PopoutLeadListBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    Dim selectedItem As String
    selectedItem = Me.PopoutLeadListBox.Column(61)
    
    Set ws = ThisWorkbook.Sheets(Mark1.LEADLISTDROPDOWN.Value)
    
    
    Mark1.WHYTEXTBOX.Value = Application.XLookup(Val(selectedItem), ws.Range("BI:BI"), ws.Range("CN:CN"))
    End Sub
    Private Sub PopoutLeadListBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    Dim selectedItem As String
    selectedItem = Me.PopoutLeadListBox.Column(11)
    
    Set ws = ThisWorkbook.Sheets(SalesForm.BHSDLEADLISTSCOMBOBOXLF.Value)
    
    SalesForm.BHSDTAPNAMELF.Value = Application.XLookup(Val(selectedItem), ws.Range("S:S"), ws.Range("T:T"))
    The first code is returning a type mismatch error on this line:

    Mark1.WHYTEXTBOX.Value = Application.XLookup(Val(selectedItem), ws.Range("BI:BI"), ws.Range("CN:CN"))
    But this isn't a problem for the second. To my knowledge, both of these workbooks are formatted the same, as well. Am I overlooking something?

    I'm having a hard time posting a sample workbook of this, so I'm hoping it is something stupid.

    Crossposted @ stackoverflow, but don't have permission to post links.
    Last edited by Dylan1023; 08-03-2023 at 05:53 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA code error- type mismatch
    By lemonap618 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-17-2016, 08:01 PM
  2. Help with VBA Type 13 Mismatch error code
    By nealasmothers in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-04-2015, 04:07 PM
  3. [SOLVED] Error 13, type mismatch from code.
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-25-2014, 05:14 AM
  4. [SOLVED] Type Mismatch error ==> do some code before exiting sub
    By drawing.blanks in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2012, 10:42 PM
  5. type mismatch error in code
    By strikeofdawn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2008, 08:34 PM
  6. Type Mismatch error in VBA code
    By bobby in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-10-2005, 04:10 AM
  7. [SOLVED] Type Mismatch Error when getting data from another workbook
    By Tony Zappal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2005, 07:06 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