- 帖子
- 25
- 主題
- 7
- 精華
- 0
- 積分
- 53
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2014-12-4
- 最後登錄
- 2018-6-6
|
各位大大 可幫忙看看 指導一下 謝謝@@
本程序動作流程
右方 K12:k14
"領料批號"(有使用資料驗證>清單 抓取左邊D4:D10"領料批號" 號碼)
"使用日期"
"使用尺數"
key入後按"領料"
它會依key入的"領料批號"
去搜尋左方D4:D10"領料批號"
在下方插入儲存格 d5:h5
會把 右邊key 入的 "領料批號" "尺數" "日期" 帶入
尺數 會順便 計算 55-5 = 50
Q1 當搜尋時 它會 先搜尋到 批號後 再去搜尋 後方 H4:H6 1.2到後最一碼時 新增3 自動新增將資料- Sub 進貨()
- If Range("k6").Value = "" Or Range("k7").Value = "" Then
- MsgBox ("資料未填入")
- Exit Sub
- End If
-
- Range("a1").Select
- Selection.End(xlDown).Select
- Range("a" & ActiveCell.Row + 1) = Range("k6").Value
- Range("b" & ActiveCell.Row + 1) = Range("k7").Value
-
- Cells(Rows.Count, "$L").End(xlUp).Offset(1).Value = Range("k6").Value & Range("k7").Value
- With Cells(Rows.Count, "$d").End(xlUp).Offset(1)
- .Value = Range("k6").Value & "001"
- .AutoFill Destination:=.Resize(Val(Range("k7"))), Type:=xlFillSeries
- End With
-
- Range("A3:B1001").Select
- Selection.Sort Key1:=Range("A3"), Order1:=xlDescending, Header:=xlGuess, _
- OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
- :=xlStroke, DataOption1:=xlSortNormal
- 'A:C的排序
-
- Range("D3:H1001").Select
- Selection.Sort Key1:=Range("D3"), Order1:=xlDescending, Header:=xlGuess, _
- OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
- :=xlStroke, DataOption1:=xlSortNormal
- 'D:H的排序
-
- Range("k6:k7").Value = ""
-
- Range("a1").Select
-
- MsgBox "處理完成"
-
- End Sub
複製代碼- Sub 領料()
-
-
- If Range("k12").Value = "" Or Range("k13").Value = "" Or Range("k14").Value = "" Then
- MsgBox ("資料未填入")
- Exit Sub
- End If
-
- Dim f_cell, f_range As Range
- Set f_range = Columns("D")
-
- Set f_cell = f_range.Find([K12].Value)
- If f_cell Is Nothing Then MsgBox ("查無此批號") Else f_cell.Select
- Selection.Offset(0, 2).Select
- ActiveCell.Value = Range("K13").Value
- Selection.Offset(0, 1).Select
- ActiveCell.Value = Range("K14").Value
- Selection.Offset(1, -3).Resize(, 5).Select
- Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
- Selection.Offset(0, 0).Resize(, 1).Select
- ActiveCell.Value = Range("K12").Value
- Selection.Offset(0, 1).Select
- ActiveCell.Value = Selection.Offset(-1, 0).Value - Selection.Offset(-1, 2).Value
-
- 'Range("k12").Value = ""
- 'Range("k14").Value = ""
- 'Range("a1").Select
-
- MsgBox "處理完成"
-
- '儲存格自動抓取電腦日期
- 'DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY()))
-
- End Sub
複製代碼 |
-
-
1.jpg
(71.63 KB)
|