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

[µo°Ý] Excel VBA Àx¦s®æ¦rÅéÅܦâ¨Æ©y(¤£¦P§Ç­¶µLªkÅܦâ¡^

[µo°Ý] Excel VBA Àx¦s®æ¦rÅéÅܦâ¨Æ©y(¤£¦P§Ç­¶µLªkÅܦâ¡^

¨Ï¥Î³nÅé¡GExcel 2003 SP3

¦U¦ì¥ý¶i¦n
¡@¡@¤p§Ì¦bExcelªºVBA¤¤¼g¤F¨â¦æµ{¦¡¡A¬OÃö©óExcelÀx¦s®æ¤ºªº¦rÅéÅܦâ¨Æ©y¡C¡]¥ÎIf.....Thenªº»yªk¡^
¥O¤p§Ì¤£¸Ñªº¬O¡A³o¨â¦æµ{¦¡¦b¸ÓÀɪºSheet3°õ¦æ¬O¥i¦æªº¡]¹Ï1)¡A¦ý¦b¸ÓÀɪºSheet1°õ¦æ«o¤£¦æ¡I(¹Ï2)

µù¡G¯»¬õ¦â®Ø¬°µ{¦¡»yªk¡C

¹Ï1



¹Ï2



¥H¤W¡A½Ð¦U¦ì¥ý¶i¤£§[«ü±Ð¡A¯¬¥­¦w¶¶¤ß¡C
¿ú¬O«Ü±I²öªº¡A©Ò¥H·|·Q¿ìªk»E¦b¤@°_¡I

¦^´_  syuan
¸Õ¸Õ¬Ý
GBKEE µoªí©ó 2012-10-26 17:48



·PÁ¤j¤jµL¨p¤À¨É,«D±`¨ü¥Î!
For Each A In Sheets("Sheet1").UsedRange

Each
USeRange
³o¨â­Ó¥Îªk¤p§Ì·M¬NÀµ½Ð¤j¤j¸Ñ»¡!

TOP

¦^´_ 14# GBKEE


·PÁÂGBKEE¤j
¨º­ÓINSTRªº»yªk¡A¤p§Ì¤w¦³¨Ì±z´£¨Ñªº¤è¦¡¸Õ¥X¡C
²{¤p§Ì¥¿¸ÕµÛ±N³o­Ó»yªk¨Ó±a¤J¦Û¤v¥¿¦b¬ã¨sªº¤pµ{¦¡¤¤¡C
¿ú¬O«Ü±I²öªº¡A©Ò¥H·|·Q¿ìªk»E¦b¤@°_¡I

TOP

¦^´_ 13# syuan
¬Ý§Aªº¹Ï¤ù:  µ{¦¡½X¤£§¹¾ã
  1.     Option Explicit
  2. Sub Ex()
  3.     Dim A As Range
  4.     For Each A In Sheets("Sheet1").UsedRange.Range("C:C")
  5.         If InStr(A, "DOS*") Then A.Font.Color = vbRed
  6.     Next
  7. End Sub
½Æ»s¥N½X

TOP

¦^´_ 12# GBKEE

¦^ÂÐGBKEE¤j

¡@¡@¤p§Ì¸Õ¤F±z´£¨Ñªº¤è¦¡¡A¦ýÀx¦s®æ¤ºªº¦r¦ê¨ÃµLÅܦâ¡]¦p¤U¹Ï¡^

   

¤p§Ì¦³¬d¤FLIKEªº»¡©ú¡Aµo²{¥¦¦ü¥G¬O¥Î¨Ó¹ï·Ó¦r¦ê¥Îªº¡]¦p¤U¹Ï¡^



¥H¤W¡AÁÂÁ¡I
¿ú¬O«Ü±I²öªº¡A©Ò¥H·|·Q¿ìªk»E¦b¤@°_¡I

TOP

¦^´_ 11# syuan
¨S¿ùªº.
LIKE ¤]¥i¤ñ¹ï¦r¦ê
  1. ¥|¦¡ ¤À§O °õ¦æ¬Ý¬Ý  
  2.     If A   LIKE  "DOS" Then A.Font.Color = vbRed
  3.     If A   LIKE  "DOS*" Then A.Font.Color = vbRed
  4.     If A   LIKE  "*DOS" Then A.Font.Color = vbRed
  5.     If A   LIKE  "*DOS*" Then A.Font.Color = vbRed
½Æ»s¥N½X

TOP

¦^´_ 10# GBKEE


    ·PÁÂGBKEE¤j

¤p§Ì¨Ì±z´£¨Ñªº»yªk¨Ó­×§ï¤p§Ìªº»yªk«á¡A¤w¯à¦¨¥\Åܧó¦rªºÃC¦â¡]¦p¤U¹Ï¡^{:3_59:}



¤£¹L¤p§Ìµo²{´NºâÀx¦s®æªº¦r§ï¬°DOSXXX «á¡A¤´µM¯à¦¨¥\Åܦâ¡C

¤]´N¬O»¡³o­Ó¼gªk¶È·j¬d²Å¦XDOS¶}ÀYªº¦r¦ê´NÅܦâ¡A¦Ó¦pªGDOS¦r¦ê«á¦³¥[§Oªº¦r´N©¿²¤¡C

¤£ª¾¤p§Ì³o¼Ëªº·Qªk¬O§_¥¿½T¡H
¿ú¬O«Ü±I²öªº¡A©Ò¥H·|·Q¿ìªk»E¦b¤@°_¡I

TOP

¦^´_ 9# syuan
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim A As Range
  4.     For Each A In Sheets("Sheet1").UsedRange
  5.         If InStr(A, "DOS") Then A.Font.Color = vbRed
  6.     Next
  7. End Sub
½Æ»s¥N½X

TOP

¦^´_ 7# luhpro


    ¦^luhpro ¤j

¤p§Ì¸Õ¤F±z«Øijªº1¡B2¡B3¡B4¶µªº¤è¦¡«á¡Aªº½T¥X²{¦p±z©Ò»¡ªº²{¶H¡C

¯u¬O¸U¤À·PÁ¡ã¡ã

¥t¥~¡A¤p§Ìªñ¤éµo²{¤Frange¦³­Ó¥susedrangeÄÝ©Ê¡A¥¦¥i¥H¥h§ì¨ú¨Ï¥Î¤¤ªºÀx¦s®æ½d³ò¡C

¤p§Ì¸Õ¤F¤@¤U³o­ÓÄÝ©Ê¡A¥¦¥i¥H¿ï¨úÀx¦s®æªº©Ò¦³½d³ò¡C

¤£¹L¤p§Ì¦b»yªk¤¤¥[¤F¤@­ÓInstrªº»yªk¡A¥´ºâÅýµ{¦¡¨Ì±ø¥ó¨ÓÅýÀx¦s®æ¤ºªº¦rÅܦâ¡A

¦ý¤£ºÞ¦p¦ó§ï¡A¥¦´N¬O¥u·|ÅܼƦrªºÃC¦â¦Ó¤w¡AµLªk¿ï¨ì¨ä¥LÀx¦s®æ¤ºªº¦r¡]¦p¤U¹Ï1)

(¹Ï1)   ­ì¥»­nÅýÀx¦s®æ¤ºªºdos¦r¦êÅܬõ¦â¡A¦ýµ{¦¡«oÅýÀx¦s®æ¤ºªº¼Æ¦r1Åܬõ¦â(Instr(1.......)


(¹Ï2) ¡@±N»yªk­×§ï«á¤]¬O§ï¨ìÀx¦s®æ¤ºªº¼Æ¦r4  (¤p§Ì§ï¬°Instr(4.......)


±q¥H¤Wªºµ²ªG¬Ý¨Ó¡A¥¦¦ü¥G¬O°w¹ï¼Æ¦r¦bÅܧó¡A¦Ó¤£¬O¨Ì¦r¦ê¦bÅܧó......=="

³oÅý¤p§Ìı±o«Ü§x´b¡A¤£ª¾¬O¤£¬O¤p§Ìªº»yªk¦³¿ù¡C

±æ¦U¦ì¥ý¶i¤£§[«ü±Ð¡AÁÂÁ¡C

¯¬¶g¥½´r§Ö¡I
¿ú¬O«Ü±I²öªº¡A©Ò¥H·|·Q¿ìªk»E¦b¤@°_¡I

TOP

¦^´_ 7# luhpro


·PÁÂluhpro¤jªº¸Ñ»¡¡A¤p§Ì¥ý¥h¸Õ¬Ý¬Ý±z»¡ªº¨º´X¶µ¡C{:3_52:}

µù¡G­ì¨Óif»yªk¤£¾A¦X¥Î¦b³oºØ±¡ªp°Ú¡A§ÚÁÙ¯u¤£ª¾¹D....=="
¿ú¬O«Ü±I²öªº¡A©Ò¥H·|·Q¿ìªk»E¦b¤@°_¡I

TOP

        ÀR«ä¦Û¦b : ¯u¥¿ªº·R¤ß¡A¬O·ÓÅU¦n¦Û¤vªº³oÁû¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD