Excel Vba Vlookup Error 13
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company excel vba vlookup error 1004 Business Learn more about hiring developers or posting ads with us Stack Overflow Questions excel vba vlookup error 2042 Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers,
Excel Vba Vlookup Error Handling
just like you, helping each other. Join them; it only takes a minute: Sign up Excel VBA VLookup - Error 13 - “Type Mismatch” up vote 2 down vote favorite I am working on a Excel
Excel Vba Vlookup In Another Worksheet
VBA Macro that gets the email of a client from another sheet. I am getting Error 13 "Type Mismatch" from the VLookup: For Each c In Range("D3:D130").Cells If c > 500 Then Dim emailadress As String Dim client_name As String Dim lookup_mail As Range Set lookup_mail = Sheets("MAILS").Range("A1:D130") client_name = Range("A" & (c.Row)).Value emailadress = Application.VLookup(client_name, lookup_mail, 4, False) If I make it this way it works just fine: emailadress = Application.VLookup("John Doe", lookup_mail, excel vba vlookup object required 4, False) So I guess there is something is wrong with the way I "declare?" client_name. Which is strange because when I output client_name in a MsgBox it pops up perfectly. (I use VBA beacause I need to send automatic emails to clients) Any help apreciated! excel vba excel-vba vlookup share|improve this question asked Jul 30 '15 at 20:15 Franco Altuna 1817 1 A Type 13 error at that point typically indicates that the value could not be found. Have you debugged and what is the value of client_name at the point of the error? Run Debug.Print char(39) & client_name & chr(39) just before the vlookup and check the Immediate window to see if there are leading/trailing spaces in the source and/or the target. –Jeeped Jul 30 '15 at 20:21 The value is correct, I get the client name, but the VLookup for some reason fails to read that value... –Franco Altuna Jul 30 '15 at 22:43 Shouldn't it be Application.WorksheetFunction.VLookup(...)? Also if you named the Range("A1:D130"), you could just put the text in VLookup, you can also make this named range dynamic so you don't worry about the size of the range changes. –PatricK Jul 30 '15 at 22:56 1 What's the purpose of If c > 500 Then? Do you mean the
in Excel. Before you post your first question, please read this short introduction
Excel Vba Vlookup Copy Paste Value
guide. When posting or responding to questions please remember our values excel 2007 vba vlookup at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom excel vba vlookup in another workbook English is not there first language and we need to allow for this in our dealings. Yours, Chandoo Hi All Please note that at the Chandoo.org Forums http://stackoverflow.com/questions/31733198/excel-vba-vlookup-error-13-type-mismatch there is Zero Tolerance to Spam Post Spam and you Will Be Deleted as a User Hui... When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post. Welcome Message to New users Spam Sample File Run time error 13 while do a Excel http://forum.chandoo.org/threads/run-time-error-13-while-do-a-excel-v-look-up.11650/ v look up Discussion in 'VBA Macros' started by Giriraj Desai, Aug 29, 2013. Giriraj Desai New Member Messages: 12 Hi I have created a macros which takes the information from the SAP and downloads into excel and formats ,recently we have upgraded from 2003 to 2007 . The file was working fine in 2003 and in 2007 I am getting an error when i run the file Could you please help me and the syntax is as below. Sub CalcDiffs() Dim lookup1, lookup2 Dim x1, x2, Diff Dim arg1, arg2, arg3, arg4 Dim myRange As Range Dim AcctVal1, AcctVal2 Dim DiffVal Dim LastCalcRowIndex Set myRange = Worksheets("Command Sheet").Range("A8:B19") ActiveSheet.Range("A3").Select Do While IsNumeric(ActiveCell.Value) = True arg1 = ActiveCell.Value AcctVal1 = ActiveCell.Offset(0, 3).Value Set myRange = Worksheets("Command Sheet").Range("A8:B19") arg2 = myRange lookup1 = Application.VLookup(arg1, arg2, 2, False) Set myRange = ActiveSheet.Range("F:I") arg2 = myRange lookup2 = Application.VLookup(lookup1, arg2, 4, False) If IsError(lookup2) = False Then AcctVal2 = lookup2 DiffVal = AcctVal1 + AcctVal2 End If
Forum Microsoft Office Application Help - Excel Help forum Excel Programming / VBA / Macros VLookup Run-time Error 13 Type Mismatch To get replies http://www.excelforum.com/showthread.php?t=711157 by our experts at nominal charges, follow this link to buy points and post your thread in our Commercial Services forum! Here is the FAQ for this forum. + Reply to Thread Results 1 to 6 of 6 VLookup Run-time Error 13 Type Mismatch Thread Tools Show Printable Version Subscribe to this Thread… Rate This Thread Current vba vlookup Rating Excellent Good Average Bad Terrible Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 12-17-2009,06:49 AM #1 KeillRandor View Profile View Forum Posts Registered User Join Date 12-15-2009 Location Moros MS-Off Ver Excel 2003 Posts 7 VLookup Run-time Error 13 Type Mismatch I have a textbox that allows users to excel vba vlookup enter data, once the length of data is 7 that textbox calls a function passing the contents of the textbox. All that seems to work fine. When I use VLookup to find the appropriate value it also seems to work until I try to show the returned value in a Msgbox. Here's the code Please Login or Register to view this content. If I comment out the last line Please Login or Register to view this content. I don't get an error but if I leave it in I get the Run-time Error 13 Type Mismatch error. Any ideas. Keill Register To Reply 12-17-2009,06:55 AM #2 davesexcel View Profile View Forum Posts Visit Homepage Forum Guru Join Date 02-19-2006 Location Regina MS-Off Ver XL 2010,2016 Posts 9,375 Re: VLookup Run-time Error 13 Type Mismatch I assume it can't find what it is looking for. Seems to work? Last edited by davesexcel; 12-17-2009 at 06:58 AM. , Excel MVP Xlorate.com, Selection Codes, YouYube Channel Regis