首页 > 解决方案 > VBA 代码 - 运行时 7 错误消息 - 内存不足

问题描述

下面的代码收到运行时 7 错误消息 - 内存不足

Private Sub CommandButton1_Click()
    Var = InputBox("Enter the test, test")

    Dim myrange As Range
    Set myrange = ThisWorkbook.Worksheets("Sheet1").Range("A1:J50").Select

    For Each Cell In myrange.Cells
        If Cells.Value = Var Then
            Cell.Interior.Color = 255
        End If
    Next 
End Sub

标签: excelvba

解决方案


推荐阅读