- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
2#
發表於 2011-4-13 19:34
| 只看該作者
回復 1# shootingstar - Sub 轉寫()
- Dim motoHani As Range, sakisht As Worksheet, sakrng As Range
- Set motoHani = [F3].Resize(7)
- If IsError(Application.Match([F2], [B3:B8], 0)) Then MsgBox "沒有 型號!! ": Exit Sub
- If [F5] = "" Then MsgBox "沒有 入出庫單號!! ": Exit Sub
- Set sakisht = Worksheets([F2].Value)
- Set sakrng = sakisht.Range("A" & Rows.Count).End(xlUp).Offset(1)
- sakrng.Resize(, 7).Value = Application.Transpose(motoHani)
- MsgBox "輸入完畢"
- End Sub
- Sub 查找()
- Dim motoHani, myRng As Range
- Set motoHani = [F3].Resize(7)
- If IsError(Application.Match([F2], [B3:B8], 0)) Then MsgBox "沒有 型號!! ": Exit Sub
- If [F5] = "" Then MsgBox "沒有 入出庫單號!! ": Exit Sub
- Set myRng = Sheets([F2].Value).Columns(3).Find([F5], LookAt:=xlWhole)
- If myRng Is Nothing Then MsgBox "沒有符合條件的資料!": Exit Sub
- Set myRng = Sheets([F2].Value).Cells(myRng.Row, 1)
- Set myRng = myRng.Resize(, 7)
- motoHani.Value = Application.Transpose(myRng)
- End Sub
複製代碼 |
|