プロが教える店舗&オフィスのセキュリティ対策術

Sub test()



Dim tbl() As Variant



Dim r As Long
Dim c As Integer



Dim buf(2) As Integer



Dim i As Integer, j As Integer



Dim ck As Boolean



'右の表を配列へ



i = -1



For c = 25 To 33 Step 4



For r = 3 To 11



i = i + 1



ReDim Preserve tbl(3, i)



tbl(0, i) = Cells(r, c).Value



tbl(1, i) = Cells(r, c + 1).Value



tbl(2, i) = Cells(r, c + 2).Value



tbl(3, i) = Cells(r, c + 3).Value



Next r



Next c



'9~12列の値と配列を比較



For r = 3 To Cells(Rows.Count, 9).End(xlUp).Row



If r Mod 13 <> 2 Then



Erase buf



For c = 9 To 11



If IsNumeric(Left(Cells(r, c).Value, 1)) Then



buf(c - 9) = Cells(r, c).Value



End If



Next c



ck = False



For i = 0 To UBound(tbl, 2)



If buf(0) = tbl(1, i) And buf(1) = tbl(2, i) And buf(2) = tbl(3, i) Then



Cells(r, 8).Value = tbl(0, i)



ck = True



Exit For



End If



Next i



If ck = False Then



Cells(r, 8).Value = "notall"



End If



End If



Next r



End Sub

質問者からの補足コメント

  • 説明足らずで申し訳ありません。
    1行ずつのコードの説明の事です・。宜しくお願いします。

      補足日時:2023/01/13 00:14

A 回答 (1件)

右上のコーナーに°°°ボタンを表記以外の何かを足してと言う意味なのでは?

    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!