vkdss
2021-05-28 00:46
浏览 52

VBA 代码可以运行但运行完提示运行错误‘5’

VBA 代码可以运行但运行完提示运行错误‘5’,无效的过程或调用参数,代码段指向If rng.Value = "┏" And rng(n + 1, 1).Value = "┗" Then行,请大神看看是什么原因 

Sub text()
Dim rng As Range, n%
n = 1
For Each rng In Range("c:c")

    If rng.Value = "┏" And rng(n + 1, 1).Value = "┗" Then
    rng.Resize(n + 1, 1).Select
    
    Selection.EntireRow.Copy Sheet2.Cells(Rows.Count, 4).End(xlUp)(2, -2)
    ElseIf rng(n + 1, 1).Value = "1" Then
    n = n + 1
    rng.Resize(n + 1, 1).Select
    
    Selection.EntireRow.Copy Sheet2.Cells(Rows.Count, 4).End(xlUp)(2, -2)
    
    
    End If

Next


End Sub
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

相关推荐 更多相似问题