本文介绍了我运行代码不匹配类型后,我在vba中收到13类错误?可以解决此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞!我运行代码不匹配类型后,我在vba中遇到类型13错误?可以解决此错误I am getting type 13 error in vba once i run the code missmatched type?Can please solve this error Sub open_read()Sub open_read() Dim i,filenum As Integer Dim txt As String,x  Var =表格("Sheet3")。范围("A1")                                                                      Dim current_path As String   current_path =" xxxxxxxxxxxxxxxxxxxxxxxxx_" &安培; Var& " .txt"   filenum = FreeFile  打开current_path输入为#filenum   i = 1  直到EOF(1)  行输入#filenum,txt   x =拆分(txt,";")  表格("Sheet1")。范围("A"& i).Resize(,UBound(x)+ 1).Value = x   i = i + 1  循环 关闭filenum '结束次级 'Sub FilterRangeCriteria() $ 错误GoTo ErrorRoutine Dim vCrit As Variant Dim wsO As Worksheet Dim wsL As Worksheet Dim rngCrit As Range Dim rngOrders As Range Set wsO = Worksheets(" Sheet1") Set wsL = Worksheets(" Sheet2") Set rngOrders = wsO.Range(" $ A $ 1")。CurrentRegion 设置rngCrit = wsL.Range(&"CritList"))   vCrit = rngCrit.Value $   rngOrders.AutoFilter _    字段:= 1,_     Criteria1:= Application.Transpose(vCrit),_    接线员:= xlFilterValues       Dim LastLine As Long       LastLine = Columns(1).Find(" *",,, xlByColumns,xlPrevious)。$ zh      '复制过滤后的数据。      范围("A1:N"& LastLine).SpecialCells(xlCellTypeVisible)。复制     '粘贴到Sheet2    表格(2).Range("B1")。PasteSpecial ErrorRoutine:     MsgBox Err.Description 结束次郎 $Dim i, filenum As IntegerDim txt As String, x Var = Sheets("Sheet3").Range("A1")                                                                      Dim current_path As String current_path = "xxxxxxxxxxxxxxxxxxxxxxxxx_" & Var & ".txt" filenum = FreeFile  Open current_path For Input As #filenum  i = 1  Do Until EOF(1)  Line Input #filenum, txt  x = Split(txt, ";")  Sheets("Sheet1").Range("A" & i).Resize(, UBound(x) + 1).Value = x  i = i + 1  LoopClose filenum'End Sub'Sub FilterRangeCriteria()On Error GoTo ErrorRoutineDim vCrit As VariantDim wsO As WorksheetDim wsL As WorksheetDim rngCrit As RangeDim rngOrders As RangeSet wsO = Worksheets("Sheet1")Set wsL = Worksheets("Sheet2")Set rngOrders = wsO.Range("$A$1").CurrentRegionSet rngCrit = wsL.Range("CritList") vCrit = rngCrit.Value rngOrders.AutoFilter _    Field:=1, _    Criteria1:=Application.Transpose(vCrit), _    Operator:=xlFilterValues     Dim LastLine As Long     LastLine = Columns(1).Find("*", , , , xlByColumns, xlPrevious).Row     'Copy the filtered data.     Range("A1:N" & LastLine).SpecialCells(xlCellTypeVisible).Copy    'Paste to Sheet2    Sheets(2).Range("B1").PasteSpecialErrorRoutine:    MsgBox Err.DescriptionEnd Sub推荐答案我在vba中收到13类错误一旦我运行代码不匹配类型?可以请解决此错误I am getting type 13 error in vba once i run the code missmatched type?Can please solve this error应该在 Visual Basic for Applications  (VBA)当您提出问题时,请务必指出发生错误的代码行,以及每个变量的类型。那行代码。When you ask your question be sure to indicate the line of code at which the error occurs, and the Type of each variable referred to in that line of code. 这篇关于我运行代码不匹配类型后,我在vba中收到13类错误?可以解决此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-15 00:49