|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
楼主,你的表格里写入了VBA代码,Private Sub Worksheet_BeforeDoubleClick(ByVal t As Range, Cancel As Boolean)
If t.Row > 5 And t.Row < 106 And t.Column = 3 And t.Rows.Count = 1 Then
Cancel = True
WPLL.Show
Else
Cancel = False
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i
For i = 6 To 105
If Len(Trim(Cells(i, 8).value)) <> 0 Then
Cells(i, 9).value = Val(Cells(i, 8).value) * Val(Cells(i, 7).value)
End If
Next i
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error Resume Next
If Target.Count = 1 Then
If Target.Column = 3 And Target.Row > 5 And Target.Row < 106 Then
If Trim(Target.Cells(1, 1).value) <> "" Then
If Sheets("系统设置").AutoFilterMode = True Then Sheets("系统设置").AutoFilterMode = False
Dim o, rowNum As Long
Dim dangMa As String
Dim crr
Dim wuHao As Boolean
wuHao = True
rowNum = Sheets("系统设置").Range("A" & Sheets("系统设置").Rows.Count).End(xlUp).Row
crr = Sheets("系统设置").Range("A5:H" & rowNum)
dangMa = UCase(Trim(CStr(Target.Cells(1, 1))))
For o = 1 To rowNum - 4
If dangMa = UCase(Trim(crr(o, 1))) Then
Range("C" & Target.Row) = Trim(crr(o, 1))
Range("D" & Target.Row) = Trim(crr(o, 2))
Range("E" & Target.Row) = Trim(crr(o, 3))
Range("F" & Target.Row) = Trim(crr(o, 4))
Range("G" & Target.Row) = Val(crr(o, 5))
Range("J" & Target.Row) = Trim(crr(o, 7))
wuHao = False
Exit For
End If
Next
If wuHao = True Then
MsgBox "您输入的货物编号不存在!", 48, "系统提示"
Target.Cells(1, 1).value = ""
Target.Offset(0, 0).Select
Else
Rows(Target.Row + 1).EntireRow.Hidden = False
Target.Offset(0, 4).Select
If Target.Row > 104 Then
MsgBox "单据已达到最大输入行数!", 48, "系统提示"
End If
End If
End If
End If
If Trim(CStr(Range("C" & Target.Row + 1).value)) = "" Then
If Target.Column = 7 And Target.Row > 5 And Target.Row < 106 Then
Target.Offset(0, 1).Select
End If
If Target.Column = 8 And Target.Row > 5 And Target.Row < 106 Then
Target.Offset(1, -5).Select
End If
End If
End If
Application.EnableEvents = True
End Sub
删除该代码即可。 |
|