【发布时间】:2020-04-14 11:28:17
【问题描述】:
我正在开发一个带有文本框的 Excel 用户表单,供用户输入收到或给予的美元金额。选择命令按钮后,该数字将放入电子表格单元格中。我有两个单选按钮,一个是给钱的,另一个是收钱的。
I would like the user to enter a positive amount in the box and when the given button is selected it turns into a negative.当接收到的按钮被选中时,它将使该框保持为正。
通常我会乘以 -1 将其变为负数。我试过userform.textbox.value = userform.textbox.value * -1。
Private Sub InsTxtBox_AfterUpdate()
GameLogUF.InsTxtBox = Format(GameLogUF.InsTxtBox, "$#,###")
If GameLogUF.InsPlyrOptnBtn.Value = True Then
GameLogUF.InsTxtBox.Value = GameLogUF.InsTxtBox.Value * -1
End If
End Sub
【问题讨论】:
标签: excel vba textbox userform