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