- ©«¤l
- 14
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 21
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows XP
- ³nÅ骩¥»
- SP3
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2011-3-9
- ³Ì«áµn¿ý
- 2021-10-26
|
[µo°Ý] ¨S¦³³]©wª«¥óÅܼƩΠWith °Ï¶ôÅܼÆ
¦U¦ì¦n
§Úªºµ{¦¡¦³¶¥¬q¿ù»~''91''ªº°ÝÃD¡A¦ý§Ú¹ê¦b§ä¤£¥X¨Óì¦]¡A
¥u¦n¤W¨Ó¨D±Ð¤F¡C
µ{¦¡½X¦p¤U¡G
Sub Scheduling()
With Worksheets("Scheduling")
n = .Columns("A").Find("*", SearchOrder:=xlByRows, LookIn:=xlFormulas, SearchDirection:=xlPrevious).EntireRow.Row
For i = 5 To n Step 2
ProductID = Worksheets("Scheduling").Cells(i, 3)
Set d = Sheets("KEYIN").Columns("AH").Find(ProductID, LookIn:=xlValues, lookat:=xlWhole) '¦b¸ê®Æ®w¤¤·j´M¬Ûµ¥ ®Æ¸¹ ¤§È
If Not d Is Nothing Then ' ¦pªG§ä¨ì¬Ûµ¥¤§Èªº¸Ü
Product = Worksheets("KEYIN").Cells(d.Row, d.Column + 1)
End If
.Cells(i, 4) = Product
Next i
End With
Worksheets("M").Activate
For i = 3 To 23
For Each od In ActiveSheet.Buttons
If od.Name = ("Buttons " & i) Then
od.Delete
End If
Next
For Each od In ActiveSheet.OLEObjects
If od.Name = ("CheckBox" & CStr(i)) Or od.Name = ("CheckBoxb" & CStr(i)) Then
od.Delete
End If
Next
serial = 0
machine = Worksheets("M").Cells(i, 3)
Set c = Worksheets("Scheduling").Columns("B").Find(machine, LookIn:=xlValues, lookat:=xlWhole) '¦b¸ê®Æ®w¤¤·j´M¬Ûµ¥ ¤§È
If Not c Is Nothing Then ' ¦pªG§ä¨ì¬Ûµ¥¤§Èªº¸Ü
firstAddress = c.Address
serial = 1
Do
If Worksheets("Scheduling").Cells(c.Row, 1) = Date And serial = 1 Then
ProductID = Worksheets("Scheduling").Cells(c.Row, 3)
Product = Worksheets("Scheduling").Cells(c.Row, 4)
Demand = Worksheets("Scheduling").Cells(c.Row, 5)
Operater = Worksheets("Scheduling").Cells(c.Row, 7)
Starttime = Worksheets("Scheduling").Cells(c.Row, 9)
Worksheets("Scheduling").Cells(c.Row, 11) = 1
Range(Worksheets("Scheduling").Cells(c.Row, 1), Worksheets("Scheduling").Cells(c.Row + 1, 9)).ClearContents
Worksheets("M").Cells(i, 4) = Product
Worksheets("M").Cells(i, 5) = Demand
Worksheets("M").Cells(i, 7) = Operater
Worksheets("M").Cells(i, 12) = Starttime
If Operater > 0 Then
SS = Worksheets("M").Cells(i, 1).Top '©Ò¿ï¾Üªº¥Ø¼Ð¦ì§}
ll = Worksheets("M").Cells(i, 1).Left
Set ob = Worksheets("M").Buttons.Add(ll + 940, SS + 6, 33, 19) '¥[¤J«ö¶s
ob.Characters.Text = "§¹¦¨" '«ü©w«ö¶s¤å¦r
ob.OnAction = "scheduleok" '«ü©w«ö¶s¥¨¶°
ob.Name = "Buttons " & i '«ü©w«ö¶s¦WºÙ
S = Worksheets("M").Cells(i, 7).Top '©Ò¿ï¾Üªº¥Ø¼Ð¦ì§}
l = Worksheets("M").Cells(i, 7).Left
Set ob1 = Worksheets("M").OLEObjects.Add(ClassType:="Forms.CheckBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=l, Top:=S + 1, Width:=26, Height:=13)
ob1.Name = "CheckBox" & i
ob1.Object.Caption = "¤é"
ob1.Object.Font.Size = 9
ob1.Object.ForeColor = RGB(255, 128, 128)
'ob1.Object.AutoSize = True
ob1.Object.BackColor = Worksheets("M").Cells(i, 7).Interior.Color
'ob1.Object.SpecialEffect = 0
End If
ElseIf Worksheets("Scheduling").Cells(c.Row, 1) = Date And serial = 2 Then
ProductID = Worksheets("Scheduling").Cells(c.Row, 3)
Product = Worksheets("Scheduling").Cells(c.Row, 4)
Worksheets("M").Cells(i, 13) = Product
End If
serial = 2
Set c = Worksheets("Scheduling").Columns("B").FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
Next i
End Sub
ÁٽЦU¦ì°ª¤â̬ۧU¡I |
|