excel - 我将如何使用用户窗体中的 If 语句,如果单元格与另一个单元格匹配,它将结果添加到特定字段/行?
问题描述
我的大部分代码都可以正常工作,但是,当我进入验证表单时,用户表单无法正常工作。我使用的表格允许用户在 AA 列中输入工作编号,在 AC 列中输入数量。我在 A 列中保留一份工作列表。当用户使用该按钮时,它将自动填充 AA 到 AD 列,我正在寻找完成此操作后,它将检查工作编号是否存在于 A 列中以及是否存在然后在 D 列的同一行中,它将添加刚刚输入的数量。在后台我有一段代码将自动计算并在 D 列中增加
Private Sub CommandButton1_Click()
whichSheet = PartNoTxtBox.Value
If whichSheet = "" Then
MsgBox "You didn't specify a Part Number"
Exit Sub
End If
Worksheets(whichSheet).Activate
If Me.PartNoTxtBox = "" Then GoTo MoreInfo
If Me.AddJobNoTxtBox = "" Then GoTo MoreInfo
If Me.AddShipperNoTxtBox = "" Then GoTo MoreInfo
If Me.AddQtyTxtBox = "" Then GoTo MoreInfo
If Me.AddDate = "" Then GoTo MoreInfo
''LastRow
eRow = Cells(Rows.Count, "AA").End(xlUp).Offset(1, 27).Row
Cells(eRow, 27) = AddJobNoTxtBox.Text
Cells(eRow, 28) = AddShipperNoTxtBox.Text
Cells(eRow, 29) = AddQtyTxtBox.Text
Cells(eRow, 30) = AddDate.Text
If AddJobNoTxtBox.Value = Cells(eRow, 1) Then
Cells(eRow, 4) = AddQtyTxtBox.Text
End If
Unload UserForm1
Exit Sub
MoreInfo:
MsgBox "More information required."
End Sub
问题位于 If AddJobNoTxtBox.Value=Cells... 任何方向都会有所帮助。
解决方案
推荐阅读
- reactjs - 我想传递动态变化的值来反应链接 react-router-dom
- java - Hibernate 中缺少关键字
- c++ - 在c ++中查找一个字符串是否包含在另一个没有“find”的字符串中
- python - pymongo查询中的理解列表
- docusignapi - Docusign:我们如何将值从模板传递到目标 URL 中的收件人自定义字段
- linux - 在 yocto 中使用 bitbake menuconfig 进行内核配置?
- selenium-webdriver - 无法在 Eclipse 中安装 TestNg 出现错误,例如“无法完成安装,因为找不到一个或多个必需的项目”
- c++ - 为什么我无法打印 32.0 而不是 32 尽管类型转换?
- excel - 运行时错误“1004”提取范围的字段名称缺失或无效
- javascript - 按钮在按下时变为蓝色(不是轮廓,不是选择突出显示)