编辑:仍在寻找此问题的答案,尝试此处发布的所有建议均未成功。谢谢!
我一直在尝试构建一个清单电子表格,该清单电子表格可由非编码/计算机笨拙的员工编辑。我没有参加任何编码课程,并且自学成才,因此要谦虚(我知道这不会很漂亮)。
基本上是这样的-我有一个主列表,我正在尝试从使用文本框和组合框输入到用户表单的信息中填充该列表。我具有以下类型的信息,这些信息都位于主列表的唯一列中;
零件名称,零件编号,ATA章节,数量和一个附加注释文本框,用于向带有“零件名称”的单元格添加注释(如果它与可在注释中列出但不符合条件的辅助组件包装在一起) (他们自己的专栏)。.注释框仍然是WIP。
因此,我希望每个文本框和组合框都粘贴到我的主列表中相应列的空白单元格的第一行中(我知道Access对此更好,但是无论出于什么原因,我的工作办公室套件都不包括Access)。由于某些原因,我在标出的行上始终遇到1004运行时错误。
Private Sub cboLocation_Change()
End Sub
Private Sub COMMENTS_Click()
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label5_Click()
End Sub
Private Sub NOMENCLATURE_Change()
End Sub
Private Sub PARTNAME_Click()
End Sub
Private Sub UserForm_Activate()
Dim ws As Worksheet
For Each ws In Worksheets
cboLocation.AddItem Sheet2.Name
cboLocation.AddItem Sheet3.Name
cboLocation.AddItem Sheet4.Name
cboLocation.AddItem Sheet5.Name
cboLocation.AddItem Sheet6.Name
cboLocation.AddItem Sheet7.Name
cboLocation.AddItem Sheet8.Name
cboLocation.AddItem Sheet9.Name
cboLocation.AddItem Sheet10.Name
cboLocation.AddItem Sheet11.Name
cboLocation.AddItem Sheet12.Name
cboLocation.AddItem Sheet13.Name
cboLocation.AddItem Sheet14.Name
cboLocation.AddItem Sheet15.Name
cboLocation.AddItem Sheet16.Name
cboLocation.AddItem Sheet17.Name
cboLocation.AddItem Sheet18.Name
cboLocation.AddItem Sheet19.Name
cboLocation.AddItem Sheet20.Name
cboLocation.AddItem Sheet21.Name
cboLocation.AddItem Sheet22.Name
cboLocation.AddItem Sheet23.Name
cboLocation.AddItem Sheet24.Name
cboLocation.AddItem Sheet25.Name
cboLocation.AddItem Sheet26.Name
cboLocation.AddItem Sheet27.Name
cboLocation.AddItem Sheet28.Name
cboLocation.AddItem Sheet29.Name
cboLocation.AddItem Sheet30.Name
cboLocation.AddItem Sheet31.Name
cboLocation.AddItem Sheet32.Name
cboLocation.AddItem Sheet33.Name
cboLocation.AddItem Sheet34.Name
cboLocation.AddItem Sheet35.Name
cboLocation.AddItem Sheet36.Name
cboLocation.AddItem Sheet37.Name
cboLocation.AddItem Sheet38.Name
cboLocation.AddItem Sheet39.Name
Next ws
End Sub
Public Sub SUBINF_Click()
Dim iRow As Long
'find first empty row in database
iRow = Sheet40.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'With Worksheets(ws.Name)
' iRow = .Range("B" & .Rows.Count).End(xlUp).Row + 1
'End With
'check for a part number
If Trim(Me.cboLocation.Value) = "" Then
MsgBox "Please select an ATA chapter"
Exit Sub
End If
If Trim(Me.NOMENCLATURE.Value) = "" Then
MsgBox "Please enter a part name"
Exit Sub
End If
If Trim(Me.PN.Value) = "" Then
MsgBox "Please enter a part number"
Exit Sub
End If
If Trim(Me.QTY.Value) = "" Then
MsgBox "Please enter a part quantity"
Exit Sub
End If
'If Not IsEmpty (
'copy the data to the database
'use protect and unprotect lines,
' with your password
' if worksheet is protected
With Sheet40
' .Unprotect Password:="password"
Sheet40.Cells(iRow, B).Value = Me.NOMENCLATURE.Text <----this is the error line
Sheet40.Cells(iRow, c).Value = Me.PN.Text
Sheet40.Cells(iRow, D).Value = Me.QTY.Text
Sheet40.Cells(iRow, G).Value = Me.cboLocation.Text
' .Protect Password:="password"
End With
'clear the data
Me.NOMENCLATURE.Value = ""
Me.PN.Value = ""
Me.QTY.Value = ""
Me.COM.Value = ""
Me.cboLocation.SetFocus
End Sub
Private Sub UserForm_Click()
End Sub
我了解到这是很多代码,这是整个用户表单代码,其中有些是垃圾代码,或者我尝试过的无效的代码。我只想知道我是否有语法错误,或者对于任何以此为生的人来说都是显而易见的。谢谢!