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

[µo°Ý] VBAÂI¿ïÀx¦s®æ«ü©w½d³ò¦Û°Ê¤Ï¦â

[µo°Ý] VBAÂI¿ïÀx¦s®æ«ü©w½d³ò¦Û°Ê¤Ï¦â


¥H¤Uµ{¦¡½X¬O¦bºô¸ô¤W§ä¨ìªº¡A¦ý·Q½Ð±Ð¸Ó¦p¦ó­×§ï¦¨¥H¤U·Q­nªº±ø¥ó©O¡H
1. §Æ±æ¤Ï¦â±ø¥ó¥u¦bI7:O18¦³§@¥Î¡A¥B§ï¥H¾ã¦C¤Ï¦â§e²{¡C¨Ò¦p¡GÂI¿ïK9®É¡AI9:O9·|¾ã¦C¤Ï¦â¡BÂI¿ïN15®É¡AI15:O15¾ã¦C¤Ï¦â
2. µo²{¨Ï¥Î¦¹VBA¤§«áµLªk½Æ»s¶K¤W©Î°Å¤U¶K¤W¡A¨Ò¦p·í§Ú½Æ»sB7«á¡A¥u­n·Æ¹«ÂI¿ï¥ô¦óÀx¦s®æ±ý¶K¤W®É¡A½Æ»sªº¿ï¶µ´N·|®ø¥¢¡C°Å¤U±ý¶K¤Wªº¥\¯à¥ç¬Û¦P
¥H¤W¨D¸Ñ~~~~~~~

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
   If Application.CutCopyMode = xlCopy Then Me.Paste
   On Error Resume Next
   [colorCell].FormatConditions.Delete
   Target.Name = "colorCell"
   With [colorCell].FormatConditions      ' ³]©w®æ¦¡¤Æ±ø¥ó
       .Delete
       .Add xlExpression, , "TRUE"        ' ±ø¥ó(¤@)¤º¤½¦¡¬°
       .Item(1).Interior.ColorIndex = 36  ' .Item(1)µ¥©óFormatConditions(1)
       .Item(1).Font.Bold = True
   End With
End Sub



´ú¸ÕÀÉ.rar (15.08 KB)
*¦v¤k¤@ªTµL»~*

¦^´_ 19# GBKEE

«Ü·PÁÂn¤j¡B­ã¤j¡BG¤j¤T¦ì¹©¤O¬Û§U¡C·PÁÂ~~~

¤]·PÁ¦³¯u»ò¦nªº°Q½×¶é¦a¡C

TOP

´ê¤@¸} °Ñ¦Ò¬Ý¬Ý
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2.     Dim xA As Range, xR As Range
  3.     Set xA = [I7:O18]
  4.     xA.Interior.ColorIndex = 0
  5.     If Intersect(xA, Target) Is Nothing Then Exit Sub
  6.     For Each xR In xA.Columns
  7.         If Not Intersect(xR, Target) Is Nothing Then xR.Interior.Color = vbYellow
  8.     Next
  9.     For Each xR In xA.Rows
  10.         If Not Intersect(xR, Target) Is Nothing Then xR.Interior.Color = vbYellow
  11.     Next
  12.     Target.Interior.Color = vbRed
  13. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim xA As Range, SelArea As Range, xR As Range
Set xA = [I7:O18]: xA.Interior.ColorIndex = 0
Set SelArea = Intersect(xA, Target)
If SelArea Is Nothing Then Exit Sub
For Each xR In SelArea
   xA.Rows(xR.Row - xA.Row + 1).Interior.Color = vbYellow
   xA.Columns(xR.Column - xA.Column + 1).Interior.Color = vbYellow
Next
SelArea.Interior.Color = vbRed
End Sub

TOP

¦^´_ 16# Hyuan


  ¤w¦^ÂЧA¤F¡A¤W¤W¼Ó
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¦^´_ 12# n7822123
ÁÂÁ¤j¤j¹©¤OÀ°¦£¡C
§Æ±æÀx¦s®æ©Ò¦bªº[¦æ]¤]¦³ÃC¦â¡A¦pªþ¥ó¡C

Àx¦s®æÅܦâ.zip (7.66 KB)

TOP

¥»©«³Ì«á¥Ñ n7822123 ©ó 2018-12-9 20:23 ½s¿è

¦^´_ 14# Hyuan

¬õ¦â¦r³¡¤À¡A¥i¦Û¦æ§ó§ï

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set ½d³ò = [I7:O18]   '½Ð¦Û¦æ§ó§ï­nÅܦâ½d³ò¡A¤U­±µ{¦¡ªºÃC¦â¤]¦Û¦æ§ó§ï
If Intersect(Target, ½d³ò) Is Nothing Then Exit Sub '¿ï¨ú½d³ò»P³]©w½d³òµL¥æ¶°«hÂ÷¶}
½d³ò.Interior.ColorIndex = -4142 '¥ý«ì´_µLÃC¦â
For Each rg In Target  '³v¤@½T»{¿ï¨úªº½d³ò¡A­Y¦b³]©w½d³ò¤º«h¾ã¦CÅܦâ(¿ï¨úªº½d³ò¦³¥i¯à¦b³]©w½d³ò¥~)
  If Not Intersect(rg, ½d³ò) Is Nothing Then Cells(rg.Row, ½d³ò(1).Column).Resize(, ½d³ò.Columns.Count).Interior.Color = RGB(255, 255, 0)
  If Not Intersect(rg, ½d³ò) Is Nothing Then Cells(½d³ò(1).Row, rg.Column).Resize(½d³ò.Rows.Count).Interior.Color = RGB(255, 255, 0)
Next
Intersect(Target, ½d³ò).Interior.Color = RGB(255, 0, 0) '½T»{¿ï¨úªº½d³ò¡AµM«áÅܦâ
End Sub

TT20170225-02(¿ï¨úÀx¦s®æ,¦CÅܦâ)+1.rar (9.18 KB)
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¦^´_ 11# ­ã´£³¡ªL
ªí¹F¤£§¹¾ã¡A­ìªþ¥ó§@¼o¡C

TT20170225-02(¿ï¨úÀx¦s®æ,¦CÅܦâ).zip (9.95 KB)

TOP

¦^´_ 11# ­ã´£³¡ªL

ªþ¤Wªþ¥ó
½Ð±Ð­ã¤j­n¦p¦ó°µ¨ì¦pªþ¥óªºµe­±¡C
ÁÂÁ§A¡C

TT20170225-02(¿ï¨úÀx¦s®æ,¦CÅܦâ).zip (9.94 KB)

TOP

¥»©«³Ì«á¥Ñ n7822123 ©ó 2018-12-9 15:46 ½s¿è

¦^´_ 10# Hyuan

¬O³o¼Ë¶Ü? ¬õ¦â¦r³¡¤À½Ð¦Û¦æ§ó§ï!
§Ú¨S¦³¥Î¨ì©w¸q¦WºÙªº³¡¤À

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set ½d³ò = [C4:H10]   '½Ð¦Û¦æ§ó§ï­nÅܦâ½d³ò¡A¤U­±µ{¦¡ªºÃC¦â¤]¦Û¦æ§ó§ï
If Intersect(Target, ½d³ò) Is Nothing Then Exit Sub '¿ï¨ú½d³ò»P³]©w½d³òµL¥æ¶°«hÂ÷¶}
½d³ò.Interior.ColorIndex = -4142 '¥ý«ì´_µLÃC¦â
For Each rg In Target  '³v¤@½T»{¿ï¨úªº½d³ò¡A­Y¦b³]©w½d³ò¤º«h¾ã¦CÅܦâ(¿ï¨úªº½d³ò¦³¥i¯à¦b³]©w½d³ò¥~)
  If Not Intersect(rg, ½d³ò) Is Nothing Then Cells(rg.Row, ½d³ò(1).Column).Resize(, ½d³ò.Columns.Count).Interior.Color = RGB(100, 255, 255)
Next
Intersect(Target, ½d³ò).Interior.Color = RGB(255, 0, 0) '³v¤@½T»{¿ï¨úªº½d³ò¡AµM«áÅܦâ
End Sub

Àx¦s®æÅܦâ.rar (11.11 KB)
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

        ÀR«ä¦Û¦b : ¦³¤ß´N¦³ºÖ¡A¦³Ä@´N¦³¤O¡A¦Û³yºÖ¥Ð¡A¦Û±oºÖ½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD