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

[µo°Ý] ½Ð±Ð: ¦p¦ó¦b¦P¤@SHEET ¤ºÅã¥Ü¿ï¨ú¸ê®Æ?

[µo°Ý] ½Ð±Ð: ¦p¦ó¦b¦P¤@SHEET ¤ºÅã¥Ü¿ï¨ú¸ê®Æ?

¥»©«³Ì«á¥Ñ markoxp ©ó 2014-5-23 17:27 ½s¿è

¦U¦ì®v¥S/©j¦n,

½Ð°Ý¦p¹Ï¤¤  , ¦p¦ó·í¥Î¤áÂI¿ï¥kÃ䪺¦W¦r®É, ¤ë¾ä¤¤ªº¬Û¦P¦W¦r·|¥HÃC¦â¼Ð¥Ü?
e.g:  ¦p§Ú¿ï¨ú¥kÃ䪺 apple, ¤ë¾ä¤¤ªº©Ò¦³"apple" ³£·|µÛ¦â( ©Î¨ä¥L§Î¦¡) ¼Ð¥Ü¥X¨Ó.

ÁÂÁ¤j¤j, ¦^®a¦A¸Õ¸Õ¬Ý,  ·PÁÂ

TOP

¦^´_ 3# markoxp
¸Õ¸Õ¬Ý:
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2.     Dim Rng As Range
  3.    
  4.     '­­©w Worksheet_Changeªº½d³ò
  5.     Set Rng = Range("L4:L12")
  6.     If Not Intersect(Target, Rng) Is Nothing Then
  7.         Åã¥Ü¬d§ä¸ê®Æ Target
  8.     End If
  9. End Sub

  10. Sub Åã¥Ü¬d§ä¸ê®Æ(ByVal Target As Range)
  11.     Dim sh As Worksheet
  12.     Dim findRng, Rng As Range
  13.     Dim str1 As String
  14.    
  15.     Set sh = Sheets("Sheet1")
  16.    
  17.     '³]©w ·j´M½d³ò
  18.     Set findRng = sh.[C3].Resize(26, 6)
  19.     findRng.Font.ColorIndex = 1  '¥ý±N¦r«¬ÃC¦â³]¬°¶Â¦â
  20.    
  21.     Set Rng = findRng.Find(Target, LookAt:=xlPart)     '¦b findRng ¤¤ ·j´M ActiveCell, ³¡¥÷·j´M
  22.    
  23.     If Rng Is Nothing Then
  24.         MsgBox "§ä¤£¨ì¡i" & ActiveCell & "¡j", vbCritical
  25.         Exit Sub
  26.         
  27.     '·j´Mµ²ªGÅܦâÅã¥Ü
  28.     Else
  29.         str1 = Rng.Address  '«O¦s²Ä¤@­Ó·j´Mµ²ªGªº¦ì§}
  30.         Do
  31.             Rng.Font.ColorIndex = 3
  32.             Set Rng = findRng.FindNext(Rng)    '´M§ä¤U¤@­Ó Target
  33.         Loop Until Rng.Address = str1    'ª½¨ì¤S¦^¨ì²Ä¤@­Ó·j´Mµ²ªGªº¦ì§}
  34.     End If
  35.         
  36. End Sub
½Æ»s¥N½X

TOP

¦^´_  markoxp
¤j¤j§A¦n, ¯à¤£¯àªþÀÉ»¡©ú?
yen956 µoªí©ó 2014-5-24 14:03


Microsoft Office Excel ¤u§@ªí.zip (10.7 KB)
¥ýÁÂÁ§Aªº¦^´_ :handshake

TOP

¦^´_ 1# markoxp
¤j¤j§A¦n, ¯à¤£¯àªþÀÉ»¡©ú?

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