- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 119
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2025-5-17
               
|
8#
發表於 2011-6-6 22:11
| 只看該作者
- Private Sub push()
- 10
- n = InputBox("輸入商品編號", , "")
- ar = Array("編號", "品名", "售價")
- With Sheets("資料庫")
- Set a = .[A:A].Find(n, lookat:=xlWhole)
- If a Is Nothing Then MsgBox "無此編號": GoTo 10
- Do Until n = ""
- If Application.CountBlank([A1:I18]) = 0 Then MsgBox "A4紙張已滿": Exit Sub
- Set b = Range("A1:I18").SpecialCells(xlCellTypeBlanks).Cells(1)
- b.Resize(, 3) = ar
- b.Offset(1, 0).Resize(, 3) = Array(a.Value, a.Offset(, 1).Value, a.Offset(, 7).Value)
- n = InputBox("輸入商品編號", , "")
- Set a = .[A:A].Find(n, lookat:=xlWhole)
- If a Is Nothing Then MsgBox "無此編號": GoTo 10
- Loop
- End With
- End Sub
複製代碼 |
|