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

[µo°Ý] ¤u§@ªíWorksheet_Change¦³¥¨¶°¡A¨Ï¥Î¥kÁä¶K¤W¸ê®Æexcel·|·í±¼

[µo°Ý] ¤u§@ªíWorksheet_Change¦³¥¨¶°¡A¨Ï¥Î¥kÁä¶K¤W¸ê®Æexcel·|·í±¼

½Ð°Ý:
¤u§@ªíWorksheet_Change¼g¦³¥¨¶°¡A¨ä¥¨¶°¤º®e¥D­n¬OÀˬd­Èªº§ïÅÜ
ex:·íTarget(³Q§ïÅܪºÄæ¦ì)=²Ä6Äæ®É¡A«h·|§ïÅܨä¥LªºÄæ¦ì­È
If Target.column= 6 Then
    On Error Resume Next
          On Error Resume Next
    If value_1 = "ABC" Or value_1 = "" Then
        Target.Offset(0, 1).Interior.ColorIndex = xlNone
        Target.Offset(0, 1).Locked = False
    Else
         Target.Offset(0, 1) = ""      
        With Target.Offset(0, 1).Interior
                  .ColorIndex = 34
                   .Pattern = xlSolid
        End With
    End If
    Target.Offset(0, 1).Locked = True
    On Error GoTo 0
End If

³oÃþªº±±¨î¨Ã¤£¥u¦³²Ä¤»Äæ,  ÁÙ¦³«Ü¦hÄæ³Q±±¨î¡A¦ý¤j¦h³£¬O¶ñ­È©Î¬O¶ñÃC¦â¡B³]«OÅ@
·|¨Ï¥Îon error resume next ¬O§Æ±æ¤£­n¦]error¦Ó°±¤U¨Ó¡C
¦^¨ì¤u§@ªí­n°µ¥kÁä½Æ»s¶K¤W®É¡A«o·|¨Ï¾ã­Óexcel·í±¼
¦ý­Y§ï¥Îctrl+c¡Bctrl+v¡A«h·|¦w¥þ¹LÃö
½Ð°Ý¸Ó«ç¸Ñ¨M©O?

¦^´_ 1# tw123456789
1. on error goto next ¨º«ü¥O¥u­n¦³©ñ¤@­Ó´N¥i¥H¤F,¤£¥Î³sÄò©ñ¨â­Ó.

2. ¦]¨S¹ê¨Ò, §Ú²q´ú§ï¦¨©³¤U³o¼Ë¦³¥i¯à¥i¥H¸Ñ¨M§Aªº°ÝÃD
On Error Resume Next
        Target.Offset(0, 1).Locked = False  ' ·h¨ì³o¸Ì - ­nÅܧóÀx¦s®æ®æ¦¡©Î¤º®e«e¥ý¸ÑÂê
    If value_1 = "ABC" Or value_1 = "" Then
        Target.Offset(0, 1).Interior.ColorIndex = xlNone
    Else
         Target.Offset(0, 1) = ""      

3. ¦pªG¤W­z¤è¦¡µL®Ä.

¦]¬°¨S¦³´£¨Ñ¹ê»Úªºµ{¦¡¥i¥H°lÂÜ,
©Ò¥H§Ú¶È¯à²q´ú°ÝÃDµo¥Íªº¥i¯à­ì¦] :
µ{¦¡·|·í±¼ªº­ì¦]¨Ì§Úªº¸gÅçÀ³¸Ó¬O°õ¦æ¹Lµ{¤¤¥X²{ "µL­­°j°é" ªº±¡§Î³y¦¨ªº.

§A¥i¥H¬G·N¦AÅý¥¦µo¥Í¦¹±¡§Î,
µM«á«ö¤U Ctrl+Break µ{§Ç·|°±¦b¬Y¤@¦æ«ü¥O¤W,
±µµÛ«ö¤U F8 ³æ¨B°õ¦æ¥HÆ[¹îµ{§Ç¨ì©³°j°é¬Oµo¥Í¦b­þ¨Ç«ü¥O¤W,
³o¼Ë·|¸û®e©ö§ä¨ì°ÝÃDÂI.

TOP

        ÀR«ä¦Û¦b : ¥¬¬I¦p¼½ºØ¡A¥HÅw³ß¤ß´þ¼íºØ¤l¡A¤~·|µoªÞ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD