0
關於excel格式的簡短問題。單元格格式
我目前正在使用基於用戶表單的協議工具。用戶窗體基本上由兩個輸入窗口組成,一個用於加載現有的子彈點,另一個用於添加新的點。
此外,我希望將粗體字的日期添加到每個項目符號點。我通過搜索日期出現的字符串中的位置(通過instrrev
),然後將接下來的10個字符的字體更改爲粗體字體來實現該功能。
現在,當創建一個新的項目符號點時,它的工作原理非常好,但是當我向現有主題添加一個額外的點或者當我更改舊的項目符號點(然後整個文本是粗體)時,它總是會出現混亂。任何人都知道這是爲什麼發生?
Private Sub Fertig_Click()
Dim neu As String
Dim i As Integer
neu = Date & ": " & mitschrieb_neu.Value
'No Changes
If mitschrieb_neu.Value = "" And mitschrieb_alt.Value = ActiveCell.Value Then
Unload Me
Exit Sub
End If
'First bullet point
If mitschrieb_neu.Value <> "" And ActiveCell.Value = "" Then
ActiveCell.Value = neu
i = InStrRev(ActiveCell.Value, Date)
ActiveCell.Characters(i, 10).Font.Bold = True
Unload Me
Exit Sub
End If
'New bullet point
If mitschrieb_neu.Value <> "" And ActiveCell.Value <> "" Then
ActiveCell.Value = ActiveCell.Value & Chr(10) & neu
i = InStrRev(ActiveCell.Value, Date)
ActiveCell.Characters(i, 10).Font.Bold = True
Unload Me
Exit Sub
End If
'Changed an old bullet point
If mitschrieb_neu.Value = "" And mitschrieb_alt.Value <> ActiveCell.Value Then
ActiveCell.Value = mitschrieb_alt.Value
Unload Me
Exit Sub
End If
End Sub
美麗。非常感謝你。 – Maverick13