VBA EXCEL实例 wj-wangjun

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 IntegerByVal Shift As IntegerByVal x As SingleByVal 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

转载于:https://www.cnblogs.com/wj-wangjun/archive/2007/08/29/875041.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值