ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¨D¸Ñ!!¸ê®Æ¤@¹ï¦hªºÅçÃÒ

[µo°Ý] ¨D¸Ñ!!¸ê®Æ¤@¹ï¦hªºÅçÃÒ

¦U¦ì«e½ú­Ì¦n¡I¤p§Ì§V¤OÁȨú¿n¤À¤¤
¦b³oÃä§ä¨ì¤F¦p¦ó¥[¤J±b¸¹±K½XÅçÃÒªº¤è¦¡
¥Ø«e¦³ªí®æÄæ¦ì®Æ¸¹­n¸ò»sµ{ÅçÃÒ¡A±a¥X«á­±ªº»sµ{¤u®É¸ê®Æ
µo²{¥u¯à¤@¹ï¤@ªº¶i¦æÅçÃÒ
¸ê®Æ¦pªG¦P®É¦³¤@µ§¥H¤Wªº®Æ¸¹¥u¯à¸ò²Ä¤@µ§§@ÅçÃÒ
½Ð«e½ú­Ì«ü¾É¤@¤U¦p¦ó¤@¹ï¦hªº¶i¦æÅçÃÒ><
µn¤J¤u¸¹¡G1¡A±K½X¡G1
¥Í²£¹êÁZ®Ä²v -¤@¹ï¦h.rar (148.78 KB)


¶¶«K½Ð°Ý¤@¤U
­×§ï±K½Xªºªí³æ¥Î±b¸¹ÅçÃÒªº¤è¦¡¥h±N·sªº±K½X­È¨ú¥N­ì±K½XÄæ¦ì
³o­Ó«äºû¬O¥i¦æ¶Ü?

¦^´_ 1# bsy4life
¤p§Ì¥u°w¹ï¤@¹ï¦h¤è­±´£¨Ñ²L¨£(workªºUserForm¾Þ§@¼Ò¦¡)¡A­Y²Å¦X»Ý¨D«h½Ð¦Û¦æ§ï¼gµ{¦¡½X¡C
1.®Æ¸¹(TextBoxProductNumber)»Ý§ï¬°¤U©Ô¦¡¡A¤@¤è­±°£§K°£¨¾§bµ{¦¡½Xªº¼g§@¥~¡A¥ç¥i´£¤É¨Ï¥ÎªÌ¾Þ§@®Ä²v¡C
2.©óUserForm_Initialize¨Æ¥ó¤¤¡A¥²¶·¥ý¦Ü[»sµ{¤u®É]ªºAÄæ¨Ó¼´¨ú°ß¤@®Æ¸¹¡A¦s¤J®Æ¸¹¤U©Ô¸ê®Æ²M³æ¤¤¡C
3.©óUserForm_Initialize¨Æ¥ó¤¤¡AÁٻݷdzƮƸ¹©Ò¹ïÀ³ªº¦hµ§[»sµ{]¡B[¤u®É]¸ê®Æ¦s¤J°}¦C«Ý¥Î¡C
4.¨C·í®Æ¸¹¤U©Ô¸ê®Æ²£¥ÍChange¨Æ¥ó®É¡A»sµ{(ComboBoxProcess)¤U©Ô¤ºªº¸ê®Æ¡A»Ý±q«Ý¥Îªº°}¦C¤¤¨ú±o¨Ã±q·s¼g¤J¡C
5.¨C·í»sµ{(ComboBoxProcess)²£¥ÍChange¨Æ¥ó®É¡A¶·±q«Ý¥Îªº°}¦C¤¤¨ú±o¸ê®Æ¼g¤JLabeExceptTimeShow¤ÎLabelProcessTimeShow¡C

TOP

¦^´_ 2# Kubi

    ¤p§Ì¥u°w¹ï¤@¹ï¦h¤è­±´£¨Ñ²L¨£(workªºUserForm¾Þ§@¼Ò¦¡)¡A­Y²Å¦X»Ý¨D«h½Ð¦Û¦æ§ï¼gµ{¦¡½X¡C
1.®Æ¸¹(TextBoxProductNumber)»Ý§ï¬°¤U©Ô¦¡¡A¤@¤è­±°£§K°£¨¾§bµ{¦¡½Xªº¼g§@¥~¡A¥ç¥i´£¤É¨Ï¥ÎªÌ¾Þ§@®Ä²v¡C

¨º¦pªG¦³¤@¦ÊºØ®Æ¸¹¡A§Ú­n©Ô«Üªø­C~~¶¶«K½Ð±Ð¤@¤UcomboboxµLªk¥Î·Æ¹«ºu°Ê¬O­n«ç»ò§ï@@?
¤§«á®Æ¸¹À³¸Ó¤ñ¸ûÄÝ©ó¨ê±ø½Xªº³¡¤À

2.©óUserForm_Initialize¨Æ¥ó¤¤¡A¥²¶·¥ý¦Ü[»sµ{¤u®É]ªºAÄæ¨Ó¼´¨ú°ß¤@®Æ¸¹¡A¦s¤J®Æ¸¹¤U©Ô¸ê®Æ²M³æ¤¤¡C
3.©óUserForm_Initialize¨Æ¥ó¤¤¡AÁٻݷdzƮƸ¹©Ò¹ïÀ³ªº¦hµ§[»sµ{]¡B[¤u®É]¸ê®Æ¦s¤J°}¦C«Ý¥Î¡C
4.¨C·í®Æ¸¹¤U©Ô¸ê®Æ²£¥ÍChange¨Æ¥ó®É¡A»sµ{(ComboBoxProcess)¤U©Ô¤ºªº¸ê®Æ¡A»Ý±q«Ý¥Îªº°}¦C¤¤¨ú±o¨Ã±q·s¼g¤J¡C
5.¨C·í»sµ{(ComboBoxProcess)²£¥ÍChange¨Æ¥ó®É¡A¶·±q«Ý¥Îªº°}¦C¤¤¨ú±o¸ê®Æ¼g¤JLabeExceptTimeShow¤ÎLabelProcessTimeShow¡C

³o³¡¤À§Ú¨ú§¹¸ê®Æ«á¡A¸Ó«ç»ò¹ê§@°}¦Cªº³¡¤À©O?
¥i¥H²³æªº¬°¤p§Ì¥Ü½d¤@¤U¶Ü~?

TOP

¦^´_ 3# bsy4life
½Ð°Ñ¦Ò¡C
¥Í²£¹êÁZ®Ä²v -¤@¹ï¦h-1.rar (152.57 KB)

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-6-22 05:00 ½s¿è

¦^´_ 3# bsy4life


   
¶¶«K½Ð±Ð¤@¤UcomboboxµLªk¥Î·Æ¹«ºu°Ê¬O­n«ç»ò§ï

¤£¬O¦³¤è¦VÁä¥i¥Î

work ªí³æ¼Ò²Õµ{¦¡½X¸Õ¸Õ¬Ý
TextBoxProductNumber,TextBoxMachineNumber,ComboBoxProcess
¬Ò§ï¬° ComboBox ªº±±¨î¶µ ¨ä BoundColumn ÄÝ©Ê ½Ð«ü©w=1
  1. Dim d As Object, Msg As Boolean  '³oªí³æ¼Ò²Õ ªº¨p¥ÎÅܼÆ
  2. Private Sub UserForm_Initialize()
  3.      TextBoxWorkOrderNumber = New_TextBoxWorkOrderNumber
  4.      TextBoxProductNumber_MakeList
  5.      TextBoxMachineNumber_MakeList
  6.      Msg = True
  7. End Sub
  8. Private Sub TextBoxProductNumber_Change()
  9.    With ComboBoxProcess  ' »sµ{ ±±¨î¶µ
  10.         .Clear
  11.         If TextBoxProductNumber.ListIndex > -1 Then
  12.             If d(TextBoxProductNumber.Value).Rows.Count = 1 Then
  13.                 .AddItem d(TextBoxProductNumber.Value).Cells(2)  '®Æ¸¹¥u¦³¤@­Ó
  14.             Else
  15.                 .List = d(TextBoxProductNumber.Value).Columns(2).Value '¬Û¦P®Æ¸¹ ¤£¥u¤@­Ó  ªº»sµ{½d³ò
  16.             End If
  17.             .ListIndex = 0
  18.         End If
  19.     End With
  20.     xChicked
  21. End Sub
  22. Private Sub ComboBoxProcess_Change()
  23.     LabeExceptTimeShow.Caption = ""
  24.     LabelProcessTimeShow.Caption = ""
  25.     With ComboBoxProcess
  26.         If .ListIndex > -1 Then
  27.             ' ***  d(TextBoxProductNumber.Value) ->Range ª«¥ó***
  28.             LabeExceptTimeShow.Caption = d(TextBoxProductNumber.Value).Cells(.ListIndex + 1, "C")
  29.             LabelProcessTimeShow.Caption = d(TextBoxProductNumber.Value).Cells(.ListIndex + 1, "D")
  30.         End If
  31.     End With
  32.     xChicked
  33. End Sub
  34. Private Sub TextBoxMachineNumber_Change() '±a¤J¾÷¾¹«¬¸¹ªº¸ê®Æ
  35.     With TextBoxMachineNumber
  36.         LabelMachineShow.Caption = ""
  37.         If .ListIndex > -1 Then LabelMachineShow.Caption = .List(.ListIndex, 1)
  38.     End With
  39.     xChicked
  40. End Sub
  41. Private Sub TextBoxWorkOrderNumber_Change()
  42.     xChicked
  43. End Sub

  44. Private Sub CommandButtonSend_Click()
  45. Dim Rng As Range, BtnCode As Integer
  46.     If MsgBox("·s¼W¬£¤u  - " & TextBoxWorkOrderNumber, vbYesNo + 16 * 2, "¸ê®Æ°e¥X") = vbNo Then Exit Sub
  47.     With Sheets("·s¼W¬£¤u")
  48.         Set Rng = .Range("A1").End(xlDown)
  49.         If Rng.Row = Rows.Count Then Set Rng = .Range("A1")
  50.     End With
  51.     With Rng.Offset(1)
  52.         .Cells(1, 1) = TextBoxWorkOrderNumber.Value '¤u³æ½s¸¹
  53.         .Cells(1, 2) = TextBoxProductNumber.Value '®Æ¸¹
  54.         .Cells(1, 3) = ComboBoxProcess.Text  '»sµ{
  55.         .Cells(1, 4) = TextBoxMachineNumber.Value  '¾÷¾¹½s¸¹
  56.         .Cells(1, 5) = LabelMachineShow.Caption  '¾÷¾¹«¬¸¹
  57.         .Cells(1, 6) = LabeExceptTimeShow.Caption '°£¥~¤u®É
  58.         .Cells(1, 7) = LabelProcessTimeShow.Caption '³æ¦¸¤u®É
  59.     End With
  60.     TextBoxProductNumber.ListIndex = -1
  61.     TextBoxMachineNumber.ListIndex = -1
  62.     ComboBoxProcess.ListIndex = -1
  63.     BtnCode = CreateObject("WScript.Shell").popup("¦¹Àɮפw¦Û°Ê¦sÀÉ", 1, Caption)
  64.     ThisWorkbook.Save
  65.     TextBoxWorkOrderNumber = New_TextBoxWorkOrderNumber
  66.     BtnCode = CreateObject("WScript.Shell").popup("¤u³æ½s¸¹ " & TextBoxWorkOrderNumber, 2, Caption)
  67.     TextBoxWorkOrderNumber.SetFocus
  68. End Sub
  69. Private Sub CommandButtonExit_Click()
  70.     End
  71. End Sub
  72. Private Sub TextBoxProductNumber_MakeList()  '»sµ{¤u®É:®Æ¸¹¸ê®Æ
  73.     Dim Rng As Range
  74.     Set d = CreateObject("scripting.dictionary")   '¦r¨åª«¥ó
  75.     Set Rng = Sheets("»sµ{¤u®É").Range("A2")
  76.     Do While Rng <> ""
  77.         If d.EXISTS(Rng.Value) Then
  78.             Set d(Rng.Value) = Union(Rng.Resize(, 4), d(Rng.Value)) '®Æ¸¹, »sµ{, °£¥~¤u®É,³æ¦¸¤u®É
  79.         Else
  80.             Set d(Rng.Value) = Rng.Resize(, 4)      '®Æ¸¹, »sµ{, °£¥~¤u®É,³æ¦¸¤u®É
  81.         End If
  82.         Set Rng = Rng.Offset(1)
  83.     Loop
  84.     With TextBoxProductNumber
  85.         .List = d.KEYS
  86.         .ListIndex = 0
  87.     End With
  88. End Sub
  89. Private Sub TextBoxMachineNumber_MakeList()  'List ¥]§t( ¾÷¾¹½s¸¹ , «¬¸¹)
  90.         With Sheets("¾÷¾¹«¬¸¹")
  91.                 TextBoxMachineNumber.List = .Range("A2:B" & .Range("A1").End(xlDown).Row).Value
  92.         End With
  93.         TextBoxMachineNumber.ListIndex = 0
  94. End Sub
  95. Private Function New_TextBoxWorkOrderNumber() As String '·s¼W ¤u³æ¸¹½X  ®æ¦¡: XXX-1234567890
  96.     Dim New_No As Variant
  97.     With Sheets("·s¼W¬£¤u").Range("A1").End(xlDown)
  98.             If .Row > 1 And .Cells <> "" Then
  99.                 New_No = Split(.Cells, "-")
  100.                 New_No(1) = Format(Val(New_No(1)) + 1, "0000000000")
  101.                 New_TextBoxWorkOrderNumber = New_No(0) & "-" & New_No(1)
  102.             End If
  103.     End With
  104. End Function
  105. Private Sub xChicked()  '¨¾§bµ{¦¡
  106.     Dim BtnCode As Integer, xOrder, Msg As Boolean
  107.     With CommandButtonSend
  108.         .Enabled = TextBoxProductNumber.ListIndex > -1 And ComboBoxProcess.ListIndex > -1 And TextBoxMachineNumber.ListIndex > -1
  109.         .Enabled = .Enabled And Len(Trim(TextBoxWorkOrderNumber)) = 14
  110.         If Len(Trim(TextBoxWorkOrderNumber)) = 14 Then
  111.              xOrder = Split(TextBoxWorkOrderNumber, "-")
  112.             If UBound(xOrder) = 0 Then Msg = True
  113.             If UBound(xOrder) = 1 Then
  114.                 If Len(xOrder(0)) <> 3 Then Msg = True   '«e¤T½X
  115.                 If Len(xOrder(1)) <> 10 Then Msg = True '«á¤Q½X
  116.                 If Len(xOrder(1)) = 10 And IsNumeric(xOrder(1)) = False Then Msg = True '«á¤Q½X»Ý¬°¼Æ¦r
  117.             End If
  118.             If Msg Then BtnCode = CreateObject("WScript.Shell").popup("¤u³æ½s¸¹ ¿ù»~  " & TextBoxWorkOrderNumber & vbLf & "¦p :xxx-1234567890", 2, Caption)
  119.             .Enabled = .Enabled And Msg = False
  120.         End If
  121.     End With
  122. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

[ª©¥DºÞ²z¯d¨¥]
  • GBKEE(2016/6/21 13:49): 5# ªºµ{¦¡½X¤w­×§ï

¦^´_ 5# GBKEE
§Ú¦³¸ÕµÛ¥Î¬Ý¬Ý
³o¬q¬O¹ê§@©óWORK FORM¶Ü
¬Ý°_¨Ó¤ñ¸û¹³¬O©ñ¦bfcckeyin
¦]¬°¥L°Ñ·Óªº¥Ø¼Ð¬O·s¼W¬£¤u¡A·s¼W¬£¤u¬O®Ú¾Ú»sµ{¤u®Éªº¸ê®Æ¥h¿é¤J
¨ä¹ê¨âÃä»Ý¨Dªº»yªkÀ³¸Ó¬O¤@¼Ë¡A¤@Ãä³q¡A´N³£¥i¥H¤F

«á¨Óµo²{¦³¨ÇÄæ¦ìµ¹Label°µ±o¤Ó¦º
¤S§ï¦¨textbox
·Q½Ð°Ý³o¬q
  1. If TypeName(xAr(i)) <> "Label" Then
½Æ»s¥N½X
¬O®Ú¾ÚlabelªºÀÉ®×ÄÝ©Ê¡A¥h°µ¤£¤@¼Ëªº¿é¥X¹ï¶Ü?
¶ã¶ã §Ú¬Oµæ³¾

TOP

¦^´_ 5# GBKEE
ÁÂÁÂGBKEE¤j¤j¶O¤ß³Ò¤O!!
§Ú¥ý§â±z´£¨Ñªºµ{¦¡½X¬ã¨s¹ý©³¦A¨Ó°õ¦æ¬Ý¬Ý
¥t¥~·Q½Ð°Ý¹³¬O³o¨Ç¹ï·Ó¡BÅçÃÒ¡A§Ú¦pªG©ñ¨ì¸ê®Æ®w
Å޿誺ºc«ä¤]¬O¦p¦¹¶Ü? ¬Q¤Ñ§âªí³æ¸ê®Æ³£©ñ¶i¸ê®Æ®w
¥Ø«e¦b­W´o«ç»ò¤ñ¹ï¡A«¢¡I

¯¬GBKEE¤j¤j¦³¬ü¦nªº¤@¤Ñ~

TOP

¦^´_ 3# bsy4life
¸É¼g[°e¥X¸ê®Æ]«ö¶sªºµ{¦¡½X¡A½Ð°Ñ¦Ò¡C
http://www.FunP.Net/330811

TOP

        ÀR«ä¦Û¦b : ¡i°±º¢¤£«e¡A²×µL©Ò±o¡j¤H³£°g©ó´M§ä©_ÂÝ¡A¦]¦Ó°±º¢¤£«e¡FÁa¨Ï®É¶¡¦A¦h¡B¸ô¦Aªø¡A¤]¤FµL¥Î³B¡A²×µL©Ò±o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD