Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 为什么此vba公式不会更改图纸的值?_Excel_Vba - Fatal编程技术网

Excel 为什么此vba公式不会更改图纸的值?

Excel 为什么此vba公式不会更改图纸的值?,excel,vba,Excel,Vba,我想询问我在下面创建的vba代码。在我测试之后,它将使图纸值保持不变。如何修复此代码,以便在工作表中更新我输入的值 谢谢,希望可以解决请查看您的更新代码。我认为问题在于单元格值赋值语句中缺少.Value属性。我还纠正了其他一些小问题,请看评论 Private Sub cmdupdate\u click() “警告 如果Me.txtName.Value=”“,则 MsgBox“请插入姓名”,请使用感叹号 Me.txtName.SetFocus'添加了我以保持一致性 出口接头 如果结束 如果Me.c

我想询问我在下面创建的vba代码。在我测试之后,它将使图纸值保持不变。如何修复此代码,以便在工作表中更新我输入的值


谢谢,希望可以解决

请查看您的更新代码。我认为问题在于单元格值赋值语句中缺少
.Value
属性。我还纠正了其他一些小问题,请看评论

Private Sub cmdupdate\u click()
“警告
如果Me.txtName.Value=”“,则
MsgBox“请插入姓名”,请使用感叹号
Me.txtName.SetFocus'添加了我以保持一致性
出口接头
如果结束
如果Me.cmbslno.Value=”“,则
MsgBox“请输入号码。”,VBEQUOTION“停止对用户喊叫
添加了“Me.cmbslno.SetFocus”-与前一个相同的行为
出口接头
如果结束
Application.ScreenUpdate=False'移动到此处,否则上面的退出子项将保持False
Dim noM作为整数“从顶部移动”,我们不需要它
noM=Val(Me.cmbslno.Val)
工作表(“数据”)。选择
“作为整数的Dim bre”已从双精度更改为整数
作为字符串的Dim msg
将组织设置为字符串
bre=Me.cmbslno.Value
bre=noM+1
行(bre)。选择
单元格(bre,2).Value=Me.txtName.Value
单元格(bre,3).Value=Me.txtPanggilan.Value
单元格(bre,4).Value=Me.txtNis.Value
单元格(bre,5).Value=Me.txtNisn.Value
单元格(bre,6).Value=Me.txttl.Value
单元格(bre,7).Value=Me.CmbJk.Value
单元格(bre,8).Value=Me.CmbAgama.Value
单元格(bre,9).Value=Me.txtSAwal.Value
单元格(bre,10).Value=Me.txtASiswa.Value
单元格(bre,11).Value=Me.txtAyah.Value
单元格(bre,12).Value=Me.txtIbu.Value
单元格(bre,13).Value=Me.txtPAyah.Value
单元格(bre,14).Value=Me.txtPIbu.Value
单元格(bre,15).Value=Me.txtJln.Value
单元格(bre,16).Value=Me.txtDesa.Value
单元格(bre,17).Value=Me.txtKec.Value
单元格(bre,18).Value=Me.txtKab.Value
单元格(bre,19).Value=Me.txtPro.Value
单元格(bre,20).Value=Me.txtHp.Value
单元格(bre,21).Value=Me.txtWali.Value
单元格(bre,22).Value=Me.txtPWali.Value
单元格(bre,23).Value=Me.txtAWali.Value
单元格(bre,36).Value=Me.txtFoto.Value
msg=“Number”&noM&“.For”&txtName.Value&”正在更新。是否继续
卸下我
org=MsgBox(msg,vbYesNo,“确认”)
如果org=vbYes,则
Me.FormData.Show
其他的
工作表(“数据”)。选择
如果结束
Application.ScreenUpdating=True
端接头

你能缩进你的代码吗?你在里面放了一个断点来测试它是否真的运行了吗?
Private Sub cmdupdate_click()
Application.ScreenUpdating = False
Dim noM As Integer
'warning
    If txtName.Value = "" Then
        MsgBox "Insert Name.", vbExclamation
        txtName.SetFocus
        Exit Sub
    End If

If Me.cmbslno.Value = "" Then
MsgBox "No Number!!!", vbExclamation, "Number"
Exit Sub
End If
noM = Me.cmbslno.Value
Sheets("data").Select
Dim bre As Double
Dim msg As String
Dim org As String
bre = Me.cmbslno.Value
bre = bre + 1
Rows(bre).Select
Cells(bre, 2) = Me.txtName.Value
Cells(bre, 3) = Me.txtPanggilan.Value
Cells(bre, 4) = Me.txtNis.Value
Cells(bre, 5) = Me.txtNisn.Value
Cells(bre, 6) = Me.txtTtl.Value
Cells(bre, 7) = Me.CmbJk.Value
Cells(bre, 8) = Me.CmbAgama.Value
Cells(bre, 9) = Me.txtSAwal.Value
Cells(bre, 10) = Me.txtASiswa.Value
Cells(bre, 11) = Me.txtAyah.Value
Cells(bre, 12) = Me.txtIbu.Value
Cells(bre, 13) = Me.txtPAyah.Value
Cells(bre, 14) = Me.txtPIbu.Value
Cells(bre, 15) = Me.txtJln.Value
Cells(bre, 16) = Me.txtDesa.Value
Cells(bre, 17) = Me.txtKec.Value
Cells(bre, 18) = Me.txtKab.Value
Cells(bre, 19) = Me.txtPro.Value
Cells(bre, 20) = Me.txtHp.Value
Cells(bre, 21) = Me.txtWali.Value
Cells(bre, 22) = Me.txtPWali.Value
Cells(bre, 23) = Me.txtAWali.Value
Cells(bre, 36) = Me.txtFoto.Value
bre = bre - 1
msg = "Number " & bre & ". For " & txtName.Value & "  Updating . Continue?"
Unload Me
org = MsgBox(msg, vbYesNo, "Confirm")
If org = vbYes Then
Me.FormData.Show
Else
Sheets("Data").Select
End If
Application.ScreenUpdating = True
End Sub