Tag:

types不匹配VBA

这工作拉斯特罗= 8,但不是9(types不匹配) 如果我删除If Not (myarray = Empty) Then它不适用于8 什么是解决这个最简单的方法? Public Function GetRowToWriteOn(ByVal SheetName As String, ByVal idnr As Integer) As Integer LastRow = (Sheets(SheetName).UsedRange.Rows.Count) + 1 MsgBox (LastRow) myarray = Sheets(SheetName).Range("d8:d" & LastRow).Value If Not (myarray = Empty) Then For row = 1 To UBound(myarray, 1) If (myarray(row, 1) = idnr) Then GetRowToWriteOn = row […]

Excelmacros“types不匹配”错误,而循环通过一列

每次调用此函数都会导致运行时错误“13”types不匹配。 为什么会这样呢? Public Function VersionExists(versionId As String) VersionExists = False For Each cell In Tabelle2.Columns(1) If cell.Value = versionId Then VersionExists = True End If Next End Function