Dim
MyVar
Private Sub CommandButton1_Click() Sub CommandButton1_Click()
Dim cgVar, jhVar, xgNumber, xNo, yNo
For xNo = 3 To 60
cgVar = ActiveWorkbook.Worksheets("采购").Range("E" & CStr(xNo)).Value
jhVar = ActiveWorkbook.Worksheets("计划").Range("F" & CStr(xNo)).Value
If (ActiveWorkbook.Worksheets("采购").Range("C" & CStr(xNo)).Value <> "" And ActiveWorkbook.Worksheets("计划").Range("D" & CStr(xNo)).Value <> "") Then
If (ActiveWorkbook.Worksheets("采购").Range("C" & CStr(xNo)).Value = ActiveWorkbook.Worksheets("计划").Range("D" & CStr(xNo)).Value) Then
If (cgVar < jhVar) Then
xgNumber = jhVar - cgVar
ActiveWorkbook.Worksheets("采购").Range("F" & CStr(xNo)).Value = xgNumber
Else
ActiveWorkbook.Worksheets("采购").Range("F" & CStr(xNo)).Value = "已全部回料!!"
End If
End If
End If
Next xNo
End Sub
Private Sub CommandButton2_Click() Sub CommandButton2_Click()
Workbooks("回料表.xls").Worksheets("采购").Columns("f").Hidden = False
End Sub
Private Sub CommandButton2_DblClick() Sub CommandButton2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Workbooks("回料表.xls").Worksheets("采购").Columns("f").Hidden = True
End Sub
Private Sub CommandButton2_LostFocus() Sub CommandButton2_LostFocus()
' If (Workbooks("回料表.xls").Worksheets("采购").Range("A6").Value! = "") Then
Workbooks("回料表.xls").Worksheets("采购").Range("A6").Value = ""
' End If
End Sub
Private Sub CommandButton2_MouseMove() Sub CommandButton2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
Workbooks("回料表.xls").Worksheets("采购").Range("A6").Value = "单击此按钮,将显示未购回数量栏,双击将隐藏!!"
Workbooks("回料表.xls").Worksheets("采购").Range("A6").Font.Size = 11
End Sub
Private Sub CommandButton3_Click() Sub CommandButton3_Click()
Dim clVal
For clVal = 3 To 1000
Workbooks("回料表.xls").Worksheets("采购").Range("F" & CStr(clVal)).Clear
Next clVal
End Sub
Private Sub CommandButton4_Click() Sub CommandButton4_Click()
CommandButton4.Caption = "asdfasdf"
UserForm1.Show
End Sub
Private Sub CommandButton1_Click() Sub CommandButton1_Click()
Dim cgVar, jhVar, xgNumber, xNo, yNo
For xNo = 3 To 60
cgVar = ActiveWorkbook.Worksheets("采购").Range("E" & CStr(xNo)).Value
jhVar = ActiveWorkbook.Worksheets("计划").Range("F" & CStr(xNo)).Value
If (ActiveWorkbook.Worksheets("采购").Range("C" & CStr(xNo)).Value <> "" And ActiveWorkbook.Worksheets("计划").Range("D" & CStr(xNo)).Value <> "") Then
If (ActiveWorkbook.Worksheets("采购").Range("C" & CStr(xNo)).Value = ActiveWorkbook.Worksheets("计划").Range("D" & CStr(xNo)).Value) Then
If (cgVar < jhVar) Then
xgNumber = jhVar - cgVar
ActiveWorkbook.Worksheets("采购").Range("F" & CStr(xNo)).Value = xgNumber
Else
ActiveWorkbook.Worksheets("采购").Range("F" & CStr(xNo)).Value = "已全部回料!!"
End If
End If
End If
Next xNo
End Sub
Private Sub CommandButton2_Click() Sub CommandButton2_Click()
Workbooks("回料表.xls").Worksheets("采购").Columns("f").Hidden = False
End Sub
Private Sub CommandButton2_DblClick() Sub CommandButton2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Workbooks("回料表.xls").Worksheets("采购").Columns("f").Hidden = True
End Sub
Private Sub CommandButton2_LostFocus() Sub CommandButton2_LostFocus()
' If (Workbooks("回料表.xls").Worksheets("采购").Range("A6").Value! = "") Then
Workbooks("回料表.xls").Worksheets("采购").Range("A6").Value = ""
' End If
End Sub
Private Sub CommandButton2_MouseMove() Sub CommandButton2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
Workbooks("回料表.xls").Worksheets("采购").Range("A6").Value = "单击此按钮,将显示未购回数量栏,双击将隐藏!!"
Workbooks("回料表.xls").Worksheets("采购").Range("A6").Font.Size = 11
End Sub
Private Sub CommandButton3_Click() Sub CommandButton3_Click()
Dim clVal
For clVal = 3 To 1000
Workbooks("回料表.xls").Worksheets("采购").Range("F" & CStr(clVal)).Clear
Next clVal
End Sub
Private Sub CommandButton4_Click() Sub CommandButton4_Click()
CommandButton4.Caption = "asdfasdf"
UserForm1.Show
End Sub