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

[µo°Ý] ¦p¦óÅý¤U©Ô¿ï³æ¿ï¨ú«á¦Û°Ê¸õ¨ìÀx¦s®æ¬Û¹ïÀ³³B?

[µo°Ý] ¦p¦óÅý¤U©Ô¿ï³æ¿ï¨ú«á¦Û°Ê¸õ¨ìÀx¦s®æ¬Û¹ïÀ³³B?

¬Û¤ù¿é¥X»ù¥Øªí.rar (23.49 KB)
¦b³W«h¦WºÙ¤U©Ô¿ï³æ¿ï¨ú«á¡A¦p¦ó¦Û°Ê¸õ¨ì¬Û¹ïÀ³ªº¼Æ¶q°Ï¡H

¨Ò¦p¡G
ÂI¤@¤UA2~·|¥X²{¤U©Ô¿ï³æ¡A¿ï¨ú«á~¦p¦ó¦Û°Ê¸õ¨ìC2¡H
µM«á¦³¦hµ§¸ê®Æ®É¡A·|Ä~ÄòÂI¤@¤UA3¡A·|¥X²{¤U©Ô¿ï³æ~¿ï¨ú«á~¦p¦ó¦Û°Ê¸õ¨ìC3¡H

¦^´_ 1# av8d


    ©Î¬O»¡§ï¦¨~·í¼Æ¶q¿é¤J«á«ö¤UEnter«á~¦Û°Ê¸õ¨ì³W®æ¦WºÙ

¨Ò¦p¡GC2¿é¤J¼Æ¦r«á«ö¤UEnter«á~¦Û°Ê¸õ¨ìA2

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-11-4 20:18 ½s¿è
  1. Private Sub ComboBox1_Change()
  2.   Application.EnableEvents = False
  3.   
  4.   ComboBox1.Visible = False
  5.   Range(ComboBox1.LinkedCell).Offset(, 2).Select
  6.   
  7.   Application.EnableEvents = True
  8. End Sub
½Æ»s¥N½X
¦^´_ 1# av8d

TOP

¦^´_ 3# stillfish00
¶¶±a½Ð±Ð¤@­Ó°ÝÃD¡G
(°²³]·s¼W¤@­Ó Excel ÀÉ®×)
¦b "¤u§@ªí2" A Äæ¦ì¤¤¦p¦ó¥h³]©w ActiveCell.Validation.Formula1 ¹ïÀ³¤U©Ô¦¡ List ªº«ü©wÄæ¦ì­È¡A
Ä´¦p¡G   "=¤u§@ªí1!$A$3:$A$20"      (§Y±q "¤u§@ªí2" A2:A10 ³£¯à¦Û°Ê¥h¹ïÀ³ "¤u§@ªí1" ªº A3:A20)
ÁÂÁ§A¡I
(¤£¦n·N«ä¡A§Ú¹ï³o¤è­±ªºÀ³¥Î±q¨SIJºN¹L  -  ¤í¾Ç)

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-11-5 09:43 ½s¿è

¦^´_ 4# c_c_lai
§A¥i¥H±q  ¸ê®Æ>¸ê®ÆÅçÃÒ>¥h³]©wÀx¦s®æ¤º²M³æ¡A¦A¿ï¨Ó·½¡C
VBA¥i°Ñ¦Ò Validation.Add ¤èªk¡C
  1.   With Sheets("¤u§@ªí2").[A2:A10].Validation
  2.     .Delete
  3.     .Add Type:=xlValidateList, Formula1:="=¤u§@ªí1!$A$3:$A$20"
  4.   End With
½Æ»s¥N½X

TOP

¦^´_ 5# stillfish00
·P¿E¡A²×©ó¤S¾Ç¨ì¦p¦ó³]©w Validation ¤F¡A
¦A¦¸ÁÂÁ§A¡I

TOP

¦^´_ 2# av8d
ºî¦X¤F stillfish00 ¤j¤j´£¨Ñªº¨ç¼Æ¡A¥H¤Î¥[¤W¾ã¦X§Aªº»Ý¨D¦Ó¦¨¡C
1.   " ÂI¤@¤UA2~·|¥X²{¤U©Ô¿ï³æ¡A¿ï¨ú«á~¦p¦ó¦Û°Ê¸õ¨ìC2 "¡A
2.   " ·í¼Æ¶q¿é¤J«á«ö¤UEnter«á~¦Û°Ê¸õ¨ì³W®æ¦WºÙ (C2¿é¤J¼Æ¦r«á«ö¤UEnter«á~¦Û°Ê¸õ¨ìA2) "
²Ä¤G¶µ»Ý¨D¡A­×§ï¦¨¡G
·í¼Æ¶q¿é¤J«á«ö¤UEnter«á~¦Û°Ê¸õ¨ì¤U¤@­Ó³W®æ¦WºÙ (C2¿é¤J¼Æ¦r«á«ö¤UEnter«á~¦Û°Ê¸õ¨ìA3 )
  1. Public ckCurr As Boolean

  2. Private Sub ComboBox1_Change()    '  stillfish00 ´£¨Ñ
  3.     If ckCurr Then Exit Sub
  4.    
  5.     Application.EnableEvents = False
  6.    
  7.     ckCurr = False
  8.     ComboBox1.Visible = False
  9.     Range(ComboBox1.LinkedCell).Offset(, 2).Select
  10.     Application.EnableEvents = True
  11. End Sub

  12. Private Sub CommandButton1_Click()
  13.     If Me.ComboBox1.Visible Then ckCurr = True: Me.ComboBox1.Visible = False
  14.    
  15.     Range("A2:A25,C2:C25").Select
  16.     Selection.ClearContents
  17. End Sub

  18. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  19.     Dim StrVdFml As String
  20.    
  21.     '  If ckCurr Then Exit Sub
  22.     On Error Resume Next
  23.         StrVdFml = Replace(ActiveCell.Validation.Formula1, "=", "")
  24.         '  ActiveCell.Validation.Formula1 ¡G  "=¤u§@ªí1!$A$3:$A$20"
  25.         '  ComboBox1.ListFillRange        ¡G   ¤u§@ªí1!$A$3:$A$20
  26.         '  Replace(ActiveCell.Validation.Formula1, "=", "") : "¤u§@ªí1!$A$3:$A$20"
  27.         '  StrVdFml : "¤u§@ªí1!$A$3:$A$20"
  28.         ActiveCell.Validation.InCellDropdown = False
  29.     On Error GoTo 0
  30.     If StrVdFml = "" Then
  31.         If Me.ComboBox1.Visible Then Me.ComboBox1.Visible = False
  32.     Else
  33.         With Me.ComboBox1
  34.             '  ComboBox1.progID   =EMBED("Forms.ComboBox.1","")
  35.             '  ComboBox1¡G        ComboBox
  36.             '  LinkedCell¡G       $A$2
  37.             '  ListFillRange ¡G   ¤u§@ªí1!$A$3:$A$20
  38.             .Left = ActiveCell.Left
  39.             .Top = ActiveCell.Top
  40.             '  .Width = ActiveCell.Width + 140
  41.             .Width = ActiveCell.Width
  42.             '  .Height = ActiveCell.Height + 10
  43.             .Height = ActiveCell.Height
  44.             '  .Font.Size = 22
  45.             .Font.Size = 12

  46.             .LinkedCell = ActiveCell.Address    '  "$A$2"
  47.             .ListFillRange = StrVdFml           '  "¤u§@ªí1!$A$3:$A$20"
  48.             .Visible = 1                        '  Åã¥Ü¤U©Ô²Å¸¹

  49.             .Object.SpecialEffect = 3
  50.             '.Object.Font.Size = ActiveCell.Font.Size
  51.         End With
  52.     End If
  53.   
  54.     ckCurr = False
  55. End Sub

  56. Private Sub Worksheet_Change(ByVal Target As Range)
  57.     '  Target.Font.ColorIndex = 5
  58.    
  59.     If Not Intersect(Target, Range("C2:C25")) Is Nothing Then
  60.         If Target(1, 1) = 0 Then Exit Sub
  61.         ckCurr = True
  62.         '  MsgBox Target.Address
  63.         Target.Offset(1, -2).Select
  64.     End If
  65. End Sub

  66. Sub CellValidation()      '  stillfish00 ´£¨Ñ
  67.     With Sheets("¤u§@ªí2").[A2:A25].Validation
  68.         .Delete
  69.         .Add Type:=xlValidateList, Formula1:="=¤u§@ªí1!$A$3:$A$20"
  70.     End With
  71. End Sub
½Æ»s¥N½X

¬Û¤ù¿é¥X»ù¥Øªí.rar (27.72 KB)

TOP

ÁÂÁÂ~stillfish00 ¤j¤jªº¸Ñµª
Åýc_c_lai¤j¤j¸Ñµª¤F§Ú¯u¥¿·Q­n¨Ï¥Îªº¥\¯à~

¨â¦ì¤j¤jÁÂÁÂ~¾Ç²ß¤F

TOP

¦^´_ 7# c_c_lai

§Ú¤U¸ü§AªºÀɮסAÂI¿ïSheet2 - A2¨S¦³¥X²{¤U©Ô¿ï³æ¡A
½Ð°Ý§ÚÁٻݭn°µ­þ¨Ç³]©w¡C
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_  c_c_lai

§Ú¤U¸ü§AªºÀɮסAÂI¿ïSheet2 - A2¨S¦³¥X²{¤U©Ô¿ï³æ¡A
½Ð°Ý§ÚÁٻݭn°µ­þ¨Ç³]©w¡C
ML089 µoªí©ó 2013-11-6 09:14

TOP

        ÀR«ä¦Û¦b : ¡i¬O§_µo´§¤F¨}¯à¡H¡j¤H¶¡¹Ø©R¦]¬°µu¼È¡A¤~§óÅã±o¬Ã¶Q¡CÃø±o¨Ó¤@½ë¤H¶¡¡AÀ³°Ý¬O§_¬°¤H¶¡µo´§¤F¦Û¤vªº¨}¯à¡A¦Ó¤£­n¤@¨ý¨Dªø¹Ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD