標題:
註解為何次數受限呢?
[打印本頁]
作者:
myleoyes
時間:
2014-4-9 07:38
標題:
註解為何次數受限呢?
各位前輩你們好!!
早安!
為何?註解只容許9筆呢?
如附檔說明
請知道的前輩,不吝賜教謝謝再三!!
上班囉!掰掰!!
Sub 增資註解(註解 As String)
Dim S(), AR(), E As Variant, i As Integer, M As Variant
With Range("G2")
.NoteText .NoteText & IIf(.NoteText <> "", Chr(10), "") & 註解
i = 1
For Each E In Split(.NoteText, vbLf)
If E <> "" Then
ReDim Preserve S(1 To i)
S(i) = E
ReDim Preserve AR(1 To i)
AR(i) = CDbl(CDate(Split(E, "增資")(0)))
i = i + 1
End If
Next
For i = 1 To UBound(AR)
M = Application.Large(AR, i)
M = Application.Match(M, AR, 0)
If i = 1 Then
.NoteText ""
.NoteText S(M)
Else
.NoteText .NoteText & vbLf & S(M)
End If
Next
.Comment.Shape.TextFrame.AutoSize = True
End With
[F2].Select '暫借用
End Sub
複製代碼
作者:
GBKEE
時間:
2014-4-9 10:16
本帖最後由 GBKEE 於 2014-4-9 10:20 編輯
回復
1#
myleoyes
詳看說明
NoteText 方法
expression.NoteText(Text, Start, Length)
expression 必選。該運算式傳回 Range 物件。
Text 選擇性的 Variant。要新增到註解中的文字 (不超過 255 個字元)。
複製代碼
Sub 增資註解(註解 As String)
Dim S(), AR(), E As Variant, i As Integer, M As Variant
With Range("G2")
'.NoteText .NoteText & IIf(.NoteText <> "", Chr(10), "") & 註解
.Comment.Text .Comment.Text & IIf(.Comment.Text <> "", Chr(10), "") & 註解
.Comment.Shape.TextFrame.AutoSize = True
End With
[F2].Select '暫借用
End Sub
複製代碼
作者:
myleoyes
時間:
2014-4-9 21:57
回復
2#
GBKEE
良師!
原程式是將最後寫入的註解放在最上面
目的是方便日後資料龐大時
比較容易對帳但
卻受限 選擇性的 Variant
要新增到註解中的文字 (不超過 255 個字元)
實太可惜也就是說無解囉!
只好將就嚕!謝謝再三!!
作者:
GBKEE
時間:
2014-4-10 05:55
回復
3#
myleoyes
要新增到註解中的文字 (不超過 255 個字元)
實太可惜也就是說無解囉!
只好將就嚕!謝謝再三!!
怎會無解,不是改成如此
.Comment.Text .Comment.Text & IIf(.Comment.Text <> "", Chr(10), "") & 註解
複製代碼
作者:
myleoyes
時間:
2014-4-10 22:06
回復
4#
GBKEE
良師!!
雖然註解可以寫入但另一程式 sub 合計 ( )還是受限最多9筆
如附檔LeoV73-2 與 LeoV73-2A說明
請再修改sub 合計 ( )辛苦囉!謝謝再三!!
Sub 增資註解(註解 As String)
With Range("G2")
If .Comment Is Nothing Then
.NoteText .NoteText & IIf(.NoteText <> "", Chr(10), "") & 註解
ElseIf [G2] <> "" Then
.Comment.Text .Comment.Text & IIf(.Comment.Text <> "", Chr(10), "") & 註解
End If
.Comment.Shape.TextFrame.AutoSize = True
End With
End Sub
Sub 合計()
[G1] = [G2].FormulaR1C1
[G1].NumberFormatLocal = """台""""幣"""
[G2].NumberFormatLocal = "#,##0_ ;[紅色]-#,##0 "
Dim S As Variant, E As Variant, A As Long
S = Split([G2].NoteText, vbLf)
For Each E In S
E = Replace(Replace(E, "增資", ","), "匯率", ",")
A = A + Val(Split(E, ",")(1)) * Val(Split(E, ",")(2))
Next
[G2] = A
Application.OnTime Now + TimeValue("00:00:03"), "恢復"
End Sub
複製代碼
作者:
GBKEE
時間:
2014-4-11 08:02
回復
5#
myleoyes
有錯當改,不夠細心
Dim S As Variant, E As Variant, A As Long
S = Split([G2].Comment.Text, vbLf)
複製代碼
作者:
myleoyes
時間:
2014-4-11 21:15
回復
6#
GBKEE
良師!! 謝謝!
不好意思..真的很歹勢啦!!
小弟疏忽囉!又讓你忙壞
深感抱歉....!!謝謝再三!!
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)