- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-12-5
|
¦^´_ 33# coafort
ÁÂÁ«e½ú¦A¦^´_
«á¾ÇÂǦ¹©«½Æ²ß¤è®×,¤è®×¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú°Ñ¦Ò
Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim Wi%, xA As Range, xR As Range, xP As Range, xI As Range
'¡ô«Å§iÅܼÆ:Wi¬Oµu¾ã¼Æ,(xA,xR,xP,xI)³£¬OÀx¦s®æÅܼÆ
With Target
On Error GoTo 99
'¡ôµ{§Ç¹J¨ì¿ù»~´N¸õ¨ì¼Ð¥Ü 99ªº¦ì¸mÄ~Äò°õ¦æ
Set xA = Intersect(.Cells, Range([A1], ActiveSheet.UsedRange)).SpecialCells(4)
'¡ô¥OxAÅܼƬO ¥æ¶°®æ(IJµo®æ»P¦³¨Ï¥Î®æ)¸ÌªºªÅ¥Õ®æ
Wi = .Worksheet.Index
'¡ô¥OWiÅܼƬO IJµo¤u§@ªí¯Á¤Þ¸¹
If InStr("/2/3/", "/" & Wi & "/") Then Set xP = [A:A,AA:AA,AO:AO,P3:P23,T3:T23,P27:P40,T27:T40]
'¡ô¦pªGIJµo¤u§@ªí¯Á¤Þ¸¹¬O 2©Î3 ,´N¥OxPÅܼƬO[]¸ÌªºÀx¦s®æ
If InStr("/4/5/7/8/", "/" & Wi & "/") Then Set xP = [A:A,AD:AD,AS:AS,Q3:Q23,V3:V23,Q27:Q40,V27:V40]
'¡ô¦pªGIJµo¤u§@ªí¯Á¤Þ¸¹¬O 4.5.7©Î8 ,´N¥OxPÅܼƬO[]¸ÌªºÀx¦s®æ
Set xI = Intersect(xP, xA)
'¡ô¥OxIÅܼƬO ¥æ¶°®æ(xPÅܼƻPxAÅܼÆ)
If xI Is Nothing Then Exit Sub
'¡ô¦pªGxIÅܼƬO µLª«¥ó? True´Nµ²§ôµ{§Ç°õ¦æ
If Intersect(xI, .Cells) Is Nothing Then Exit Sub
'¡ô¦pªG¥æ¶°®æ(xIÅܼƻPIJµo®æ)¬O µLª«¥ó? True´Nµ²§ôµ{§Ç°õ¦æ
For Each xR In xI: xR.Offset(, 1).ClearContents: Next
'¡ô³]³v¶µ°j°é!¥OxRÅܼƬO xIÅܼƸ̪º¤@®æ,¥O¥k°¼¹j¾À®æ²M°£¤º®e
99: End With
End Sub |
|