こんばんは
私はこの問題の解決策を高低で検索したので、ここにいる誰かが何が起こっているのかを知っていることを願っています!
これまでに取得したコードは以下のとおりです。私の理解では、配列バリアントを使用するため、i と n を Long として定義する必要がありますか? 現時点では、次の行の後に「実行時エラー '1004': アプリケーション定義またはオブジェクト定義のエラー」というエラーが表示されます。
If Cells(i, m) < Cells(i, (m-1)) Then
純粋にテスト目的で、i 変数と m 変数を整数に置き換えてみましたが、問題は解決しません。私を知って、私は何かを間違ってインデントしました:|
Option Explicit
Public Sub Show_Arrows()
Dim i As Integer
Dim n As Integer
Dim m As Integer
Dim Increasing() As Variant
Dim Decreasing() As Variant
Decreasing = Array(10, 11, 16, 17, 18, 19)
Increasing = Array(12, 13, 22, 25, 26, 31, 32, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 50, 51, 52, 55, 58)
m = (Month(Date) - 4)
For i = LBound(Decreasing) To UBound(Decreasing)
Cells(i, 16).Select
If Cells(i, m) < Cells(i, (m - 1)) Then
ActiveSheet.Pictures.Insert("C:\Users\jamie.rosssmith\Documents\Visual Basic Programming\Arrows - Vanessa\Green.png").Select
ElseIf Cells(i, m) > Cells(i, (m - 1)) Then
ActiveSheet.Pictures.Insert("C:\Users\jamie.rosssmith\Documents\Visual Basic Programming\Arrows - Vanessa\Red.png").Select
End If
Next
For n = LBound(Increasing) To UBound(Increasing)
Cells(n, 16).Select
If Cells(n, m) > Cells(n, (m - 1)) Then
ActiveSheet.Pictures.Insert("C:\Users\jamie.rosssmith\Documents\Visual Basic Programming\Arrows - Vanessa\Green.png").Select
ElseIf Cells(n, m) < Cells(n, (m - 1)) Then
ActiveSheet.Pictures.Insert("C:\Users\jamie.rosssmith\Documents\Visual Basic Programming\Arrows - Vanessa\Red.png").Select
End If
Next
End Sub