返回列表 上一主題 發帖

[發問] 求高手解答依條件辨別自動輸入儲存格

本帖最後由 iceandy6150 於 2014-2-8 23:11 編輯

回復 1# newlink

哈哈,我是菜鳥,寫了陽春版的
可是要怎麼讓程式能一直執行,我不會
如果設一個按鈕,每按一次,可以使用一次,只針對第二列

要怎麼隨時隨著表格輸入就馬上跳動,我不會,還要再修改

Sub ex()

Dim i
i = Sheets("工作表1").Cells(2, 1).Value
MsgBox (i)

If i = "" Then
Exit Sub

   ElseIf i = "保內" Then

        Sheets("工作表1").Cells(2, 2).Value = "--"
        Sheets("工作表1").Cells(2, 3).Value = "--"
        Sheets("工作表1").Cells(2, 4).Value = "--"
        
   ElseIf i = "二修" Then

        Sheets("工作表1").Cells(2, 2).Value = "--"
        Sheets("工作表1").Cells(2, 3).Value = "--"
        Sheets("工作表1").Cells(2, 4).Value = "--"
   
  
   ElseIf i = "保外" Then

       If Sheets("工作表1").Cells(2, 2).Value = "" Then
        Sheets("工作表1").Cells(2, 2).Value = "填金額"
       End If
        
       If Sheets("工作表1").Cells(2, 2).Value <> "" Then
        Sheets("工作表1").Cells(2, 3).Value = "=Today()"
       End If
   
Else

       If Sheets("工作表1").Cells(2, 2).Value = "" Then
        Sheets("工作表1").Cells(2, 2).Value = "填金額"
       End If
        
       If Sheets("工作表1").Cells(2, 2).Value <> "" Then
        Sheets("工作表1").Cells(2, 3).Value = "=Today()"
       End If

End If

End Sub
哈囉~大家好呀

TOP

        靜思自在 : 要批評別人時,先想想自己是否完美無缺。
返回列表 上一主題