樓主繼續潛水(10)
有問題講低,一定會有人答(除非冇)
如果有FILE要send過黎,或者有其他問題,可以用以下方法搵到我:
Telegram : @excel4freehk
E-Mail : excel4freehk@gmail.com
BTW, 個網懶得交domain錢摺埋咗了
香港中環康樂廣場 8 號
交易廣場二期 8 樓
8/F, Two Exchange Square,
8 Connaught Place, Central,
Hong Kong
=INDIRECT(A1&"[#All]")
Sub GetAllComment()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim Tempwb As Workbook: Set Tempwb = Workbooks.Add
Dim ws As Worksheet
Dim cmt As Comment
Dim MyArray As Variant
Dim i As Long
Dim j As Long
'Header
MyArray = Array("Book", "Sheet", "Cell", "Value", "Comment")
i = 1
For i = 1 To 5
Tempwb.Sheets(1).Cells(1, i).Value = MyArray(i - 1)
Next i
'Loop through all comments in workbook
i = 2
For Each ws In wb.Sheets
For Each cmt In ws.Comments
If cmt.Parent.Address <> "" Then
MyArray = Array(ThisWorkbook.Name, cmt.Parent.Worksheet.Name, cmt.Parent.Address, cmt.Parent.Value2, cmt.Text)
For j = 1 To 5
Tempwb.Sheets(1).Cells(i, j).Value = MyArray(j - 1)
Next j
i = i + 1
End If
Next cmt
Next ws
Erase MyArray
Set Tempwb = Nothing
Set wb = Nothing
Set ws = Nothing
End Sub