|
本帖最后由 hwc2ycy 于 2012-10-14 09:59 编辑
- Sub 批量合并添加批注()
- Dim sSwbk$, sDwbk$
- Dim sSsht$, sDsht$
- Dim arr, irow&, arrRst
- 'Dim dic As Object
- Dim i&, j&
- sSwbk = "B.xls"
- sDwbk = "A.xls"
- sSsht = "Sheet1"
- sDsht = "Sheet1"
- Application.ScreenUpdating = False
- With Workbooks(sSwbk).Worksheets(sSsht)
- irow = .[b1].End(xlDown).Row
- arr = .Range("c1:g" & irow).Value
- End With
- ReDim arrRst(1 To UBound(arr)) As String
- For i = 1 To UBound(arr)
- For j = 1 To UBound(arr, 2)
- If arr(i, j) <> "" Then arrRst(i) = arrRst(i) & arr(i, j) & Chr(10)
- Next
- Next
- With Workbooks(sDwbk).Worksheets(sDsht)
- irow = [b1].End(xlDown).Row
- For i = 1 To irow
- .Cells(i, 2).AddComment Text:=arrRst(i)
- Next
- End With
- End Sub
复制代码 |
|