- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
8#
發表於 2013-8-6 17:29
| 只看該作者
回復 7# ayubbs
Sheet1建一CommandButton- Private Sub CommandButton1_Click()
- UserForm1.Show
- End Sub
複製代碼
- Option Explicit
- Dim WB As Workbook, Rng As Range
- Private Sub CommandButton1_Click()
- If Not Rng Is Nothing Then
- With Rng.Parent
- Set Rng = .Range(Rng.Offset(1), Rng.Offset(1).End(xlDown))
- Rng.EntireRow.Delete
- End With
- End If
- CommandButton1.Enabled = False
- End Sub
- Private Sub TextBox1_Change()
- CommandButton1.Enabled = False
- Set Rng = WB.Sheets("明細表").Range("C:C").Find(TextBox1, LookAt:=xlWhole)
- If Not Rng Is Nothing Then CommandButton1.Enabled = True
- End Sub
- Private Sub UserForm_Initialize()
- CommandButton1.Enabled = False
- ' Set WB = Workbooks.Open("D:\你的目錄資料夾\BB.XLS") '如 BB.XLS 沒開啟用此程式碼 開啟
- End Sub
- Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
- ' WB.Close True 如 BB.XLS 不是用程式碼開啟的 不要用此程序
- End Sub
複製代碼 |
|