Sub test()
Dim Arr, T$, R&, C%, j%, ck%
With Sheets("test")
R = .[g65536].End(3).Row
If R < 5 Then MsgBox "無資料": Exit Sub
C = .UsedRange.Columns.Count
T = .[G4]
Arr = .Range(.[AF4], .Cells(4, C))
For j = 1 To UBound(Arr, 2)
If Arr(1, j) = T Then C = j + 31: ck = 1: Exit For
Next
If ck = 0 Then MsgBox "日期可能跑掉,導致無法自動記錄 工作摘要 ,請確認": Exit Sub
Arr = .Range(.[g5], .Cells(R, 7))
.Cells(5, C).Resize(R, 1) = Arr
End With
End Sub