Excel VBA¦p¦óÀˬd_§t¦³®æ¦¡¤Æ±ø¥óÀx¦s®æ¼Æ¶q
- ©«¤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-11-29
|
Excel VBA¦p¦óÀˬd_§t¦³®æ¦¡¤Æ±ø¥óÀx¦s®æ¼Æ¶q
¦U¦ì«e½ú¦n
1.½Ð±Ð Àˬd_§t¦³®æ¦¡¤Æ±ø¥óÀx¦s®æ¼Æ¶q ªºµ{¦¡½X
2.¥H¤U¬O¥ÎInterior.ColorIndex »PDisplayFormat.Interior.ColorIndexÅÜ´«§@ÅçÃÒ¬O§_¦³ ®æ¦¡¤Æ±ø¥ó
2.1.¥i¬O³oÓ¦Û¤v·Qªº¤g¤èªk¦b2003¦~ª© ¤£¤ä´©
2.2.¥i¥H³]©wªº®æ¦¡¦³«Ü¦hºØ(©³¦â.¦r¦â.²ÊÅé.±×Åé.®æ½u....µ¥),¦³¤°»ò¤èªk¥i¤@¦¸¸Ñ¨M¶Ü?
2.3.¦pªG®æ¦¡¤Æ±ø¥ó¬O³]¦b4¦X¨ÖÀx¦s®æ¸Ì!«ç»ò§P©w¥u¦³1®æ?
2.3.1.¨ú®ø¦X¨ÖÀx¦s®æ«á ¦³®æ¦¡¤Æ±ø¥ó®æ¦ì§}«ç»ò¨ú±o?
2.4.Andy·Q¶i¨B!µ{¦¡½X¤]½Ð«ü±Ð
½Ð¦U¦ì«e½ú«ü±Ð ÁÂÁÂ
Sub Àˬd_§t¦³®æ¦¡¤Æ±ø¥ó¼Æ¶q()
Dim uR As Range, formatcoN&, formatcoAD$, msg$, formatcoRng As Range
Dim orinColor&, disinColor&, orfoColor&, disfoColor&
Dim newinColor&, newdisinColor&, newfoColor&, newdisfoColor&, diF&
For Each uR In check_Area.SpecialCells(2)
diF = 0
orinColor = uR.Interior.ColorIndex
disinColor = uR.DisplayFormat.Interior.ColorIndex
If orinColor <> disinColor Then
diF = 1
GoTo 9
Else
If disinColor = -4142 Then
disinColor = 1
End If
uR.Interior.ColorIndex = disinColor + 1
newinColor = uR.Interior.ColorIndex
newdisinColor = uR.DisplayFormat.Interior.ColorIndex
uR.Interior.ColorIndex = orinColor
If newinColor <> newdisinColor Then
diF = 1
GoTo 9
End If
End If
orfoColor = uR.Font.ColorIndex
disfoColor = uR.DisplayFormat.Font.ColorIndex
If orfoColor <> disfoColor Then
diF = 1
GoTo 9
Else
If disfoColor = -4105 Then
disfoColor = 1
End If
uR.Font.ColorIndex = disfoColor + 1
newfoColor = uR.Font.ColorIndex
newdisfoColor = uR.DisplayFormat.Font.ColorIndex
uR.Font.ColorIndex = orfoColor
If newfoColor <> newdisfoColor Then
diF = 1
GoTo 9
End If
End If
9: If diF = 1 Then
formatcoN = formatcoN + 1
If formatcoAD = "" Then
formatcoAD = uR.Address
Else
formatcoAD = formatcoAD & "," & uR.Address
End If
End If
Next
If formatcoN > 20 Then
msg = "®æ¦¡¤Æ±ø¥ó¤Ó¦h!¤£Åã¥Ü®æ¦ì"
ElseIf formatcoN <> 0 Then
msg = "¦³®æ¦¡¤Æ±ø¥óÀx¦s®æ®æ¦ì: " & formatcoAD
Else
msg = "¨S¦³ ®æ¦¡¤Æ±ø¥ó"
End If
101
ck_K = "Àˬd_®æ¦¡¤Æ±ø¥ó®æ¼Æ¶q(°Ñ¦Ò)"
ck_Q = formatcoN
ck_W = msg
ck_AC = "NA"
End If
End Sub |
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|
- ©«¤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-11-29
|
³o¤g¤èªk¦b2013¦~ª©°õ¦æ ¦³®ÉÔÁÙ·|¦³NULLªº¿ù»~È! ¤£¤F¸Ñ¨äì¦]!·q½Ð«ü±Ð! |
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|
- ©«¤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-11-29
|
ÁÂÁ¦U¦ì«e½ú«ü¾É
¥H¤U³oÓ¿ìªk¹ï¶Ü?
Option Explicit
Sub Àˬd_®æ¦¡¤Æ±ø¥ó¼Æ¶q_1() 'FormatConditions.Count
Dim msg As String, foco As Range
On Error Resume Next
For Each foco In Cells.SpecialCells(2)
With foco.FormatConditions.Add(xlCellValue, xlGreater, "")
msg = msg & foco.Address
End With
Next
If msg = "" Then msg = ActiveSheet.Name & " ¨S¦³¥ô¦ó ®æ¦¡¤Æ±ø¥ó...."
MsgBox msg
End Sub |
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|
- ©«¤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-11-29
|
¦U¦ì«e½ú¦n
¤W¶Ç½d¨ÒÀɧ@»¡©ú
ÁYµu°õ¦æ®É¶¡.µ{¦¡µ²ºc....µ¥È±o«e½úÌ«Øij©Î«ü¾Éªº½Ð¤£§[«ü¾É
ÁÂÁ¦U¦ì«ü¾É |
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|
- ©«¤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-11-29
|
¦U¦ì«e½ú¦n
Andy±`À°¦P¨Æ³B²z ¶}±ÒÀÉ®×´N¥X²{ ¡§®æ¦¡¤Ó¦h¡¨ °T®§ªºÀÉ®×
1.¦P¨Æ¬O¥Î2003¦~ª©ªºExcel ¡A¶}±ÒÀÉ®×´N¥þ³¡®æ¦¡§R°£©Î¶Ã½X
2.¥Î2013¦~ª©Excel ¥i¥H¶}±Ò¡AÀ°¦£³B²z§R±¼¤@¨Ç¨S¥Îªº©U§£¸ê®Æ©Î®æ¦¡«á¡A2003¦~ª©´N¥i¥H¥Î
3.¦U¦ì«e½ú¦³¤°»ò«Øij¡AÀˬdþ¨Ç¤è±°ÝÃD¡H¥i¥HÅý°ÝÃDÀÉ®×½G¨¡B§R°£©U§£¸ê®Æ¡A¦^Âk¥¿±`ÀÉ®×¹B§@
4.¦³ÁôÂ꺩U§£¶Ü¡H
ÁÂÁ¦U¦ì«e½ú«ü¾É |
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|
- ©«¤l
- 16
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 55
- ÂI¦W
- 0
- §@·~¨t²Î
- macOS / Windows
- ³nÅ骩¥»
- Office 2010/2019
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2020-7-9
- ³Ì«áµn¿ý
- 2021-8-7
|
2.¥H¤U¬O¥ÎInterior.ColorIndex »PDisplayFormat.Interior.ColorIndexÅÜ´«§@ÅçÃÒ¬O§_¦³ ®æ¦¡¤Æ±ø¥ó
Andy2483 µoªí©ó 2020-8-6 20:31
®æ¦¡¤Æ±ø¥óªº¼Æ¶q¥i¥Hª½±µ¨Ï¥Î FormatConditions.Count ¨Ó½T»{ |
|
|
|
|
|
|
- ©«¤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-11-29
|
¦^´_ 6# cody
ÁÂÁ«e½ú«ü¾É
¦A¼·ªÅ´ú¸Õ ¬ã²ß
¥Ø«e¦£©ó¤u§@±M®×¶i¦æ |
|
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y
|
|
|
|
|