指定された数のセル(幅と高さで定義)をループしようとしていますが、ここで問題が発生しています。それは私を失速させ続け、それから次のことに腹を立てます:
If .Cells(11 + row, col).Value > maxVal Then
「アプリケーション定義またはオブジェクト定義のエラー」が発生します
誰かが私のコードのどこが間違っているのか教えてもらえますか?
Sub ApplyFilter()
Dim maxVal As Double
Dim minVal As Double
maxVal = ActiveSheet.Range("D10").Value
minVal = ActiveSheet.Range("D11").Value
Dim width As Integer
Dim height As Integer
width = ActiveSheet.Range("L3").Value
height = ActiveSheet.Range("L4").Value
Dim row As Integer
Dim col As Integer
ActiveSheet.Select
With Selection
row = 1
Do
col = 1
Do
If .Cells(11 + row, col).Value > maxVal Then
.Cells(11 + row, col).Value = 0
End If
If .Cells(11 + row, col).Value < minVal Then
.Cells(11 + row, col).Value = 0
End If
col = col + 1
width = width - 1
Loop Until width = 1
row = row + 1
height = height - 1
Loop Until height = 1
End With
End Sub