下面是程式碼分享
Sub 獲取最後一次完成的時間()
Dim sr As Range, sr1 As Range, sr2 As Range, sr3 As Range '申明資料型別變數
Set sr1 = Range("a2").End(xlDown) '向下獲取邊界
For Each sr In Range("a2", sr1) '迴圈動態獲取的區域
Set sr2 = sr.End(xlToRight) '向右獲取區域邊界
Set sr3 = sr2.EntireColumn '選擇一整列
sr(1, 22) = sr3.Range("a1").Value '從新定義起點將值賦給單元格
Next
End Sub
最新評論