Private Sub cmdbtnDone_Click()
Dim r As Range, r1 As Range
Set r = Range(RefEdit1)
Set r1 = r(1)
Chattemfrm.cmbSDPFLine.Text = ActiveWorkbook.Name
Chattemfrm.cmbPrdCde.Value = r1.Offset(0, -6).Value
Chattemfrm.txtBxLtNum.Value = r1.Offset(0, -3).Value
Chattemfrm.txtBxShopNumber.Value = r1.Offset(0, 1).Value
Chattemfrm.txtbxVndrLtNu.Value = r1.Offset(0, -2).Value
Chattemfrm.txtbxdz = Me.txtbxRangeTotal.Value
Select Case Chattemfrm.cmbSDPFLine.Value
Case Is = "SDPF - LINE 1 (SLAT).xlsx"
Chattemfrm.cmbSDPFLine.Value = "Slat"
Case Is = "SDPF - LINE 2A.xlsx"
Chattemfrm.cmbSDPFLine.Value = "Uhlmann"
Case Is = "SDPF - LINE 3.xlsx"
Chattemfrm.cmbSDPFLine.Value = "Korber"
Case Is = "SDPF - LINE 4.xlsx"
Chattemfrm.cmbSDPFLine.Value = "IMA"
End Select
Unload Me
ActiveWorkbook.Close
Chattemfrm.Show
End Sub
我不断收到运行时错误'1004':对象'_Global'的方法'Range'失败。
Chattemfrm.cmbSDPFLine.Text = ActiveWorkbook.Name
那是给我该错误代码的第一行,但是当我注释掉那行代码时,下一行给了我相同的错误,与下一行相同,并且一直在继续。我什至将.text更改为.value,但仍然收到相同的错误消息。在其他代码上,我认为这是因为我试图传递偏移值。但这也没有任何意义。 一直有人告诉我不要使用On Error Resume Next,忘了为什么,但是当我使用它时,我遇到的大多数代码都无法正常工作。任何帮助将不胜感激。