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

[µo°Ý] ½Ð¤j®v­ÌÀ°¦£¦Û°ÊÅÜ´«ÃC¦â,ÁÂÁÂ

[µo°Ý] ½Ð¤j®v­ÌÀ°¦£¦Û°ÊÅÜ´«ÃC¦â,ÁÂÁÂ

½Ð±Ð¦U¦ì¤j®v

§Ú·Q­n¨Ì"¤½¥q²M³æ"³o­Ósheet¸Ì¦Cªº¤½¥q,Åý"³]³Æ¦Cªí"³o­Ósheet¸Ì­±ªº³]³Æ¦Û°Ê¾ã¦CÅܦ⦨¬°"¤½¥q²M³æ"sheet¤º¹ïÀ³ªºÃC¦â
¦]¥»¨­¹ïÃC¦â¿ëÃѯà¤O¸û®z,¨ä±æ¥i¥H¦³¬ÛÀ³ªº¦â½X¥H¨Ñ¿ëÃÑ
§Æ±æ¯à¬Û®e©óexcel 2003~2010
½Ð¦U¦ì¤j®vÀ°¦£,·PÁÂ
´ú¸ÕÀÉ®×.zip (3.97 KB)
¤Ñ¤ÑªÅªÅ°Ú~

³sÄò¨â¦¸³£¶K¿ù¦a¤è, ¹ê¦b¤£¥i­ì½Ì!!
·Q¶Kªº¬O³o­Ó!!
¸Õ¸Õ¬Ý!!
sheet1(³]³Æ¦Cªí)ªºVBA Code¦p¤U:
  1. Option Explicit
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3.     Dim rngA As Range, rngB As Range, foundCel As Range
  4.     Dim lastRow As Long
  5.     If Target.Count > 1 Then Exit Sub         '¦pªG¤@¦¸Change¤Ó¦h®æ´NÂ÷¶}
  6.     lastRow = Sheets("¤½¥q²M³æ").Cells(Rows.Count, 2).End(xlUp).Row
  7.     Set rngA = Sheets("¤½¥q²M³æ").Range("B2:B" & lastRow & "")   '³]©w "¤½¥q²M³æ" ªº½d³òµ¹ rngA
  8.     lastRow = Cells(Rows.Count, 2).End(xlUp).Row
  9.     Set rngB = Range("B2:B" & lastRow & "")          '³]©w "³]³Æ¦Cªí" ªº½d³òµ¹ rngB
  10.     If Not Intersect(Target, rngB) Is Nothing Then
  11.         Set foundCel = rngA.Find(Target, lookat:=xlWhole)       'rngA ¤¤´M§ä Target
  12.         If Not foundCel Is Nothing Then        '¦³§ä¨ì
  13.             Target.Offset(0, -1).Resize(1, 11).Interior.ColorIndex = _
  14.                         foundCel.Offset(0, 1).Interior.ColorIndex
  15. '        Else
  16.             '«Øij "³]³Æ¦Cªí" ªº "¨Ï¥Î¤½¥q" ¥Î ÅçÃÒ²M³æ ¿é¤J
  17.             '«h¦¹³B´N¤£¥²Àˬd¿é¤J¬O§_¦³¿ù»~, ´«¨¥¤§, ´N¨S¦³ Else ³o¤@¬q
  18.             '¤S ÅçÃÒ²M³æ ¦rÅé«Ü¤p¤S¤£¯à§ï, ¤£¾A¦X®zµøªÌ,
  19.             '«Øij "³]³Æ¦Cªí" ¾ã­¶¥þ³¡§ï¥Î¤p¦rÅé, ¦A©ñ¤jÀ˵ø¤ñ¨Ò
  20.         End If
  21.     End If
  22. End Sub
½Æ»s¥N½X
sheet2(¤½¥q²M³æ)ªºVBA Code¦p¤U:
  1. Option Explicit
  2. Public colorNum As Integer

  3. '¥ý°õ¦æ¦¹VBA¤@¦¸, ¥H«Ø¥ß¥N½Xªí
  4. Sub ÃC¦â¥N½Xªí()
  5.     Dim i As Integer
  6.     For i = 1 To 28
  7.         Cells(i, 15).Interior.ColorIndex = i
  8.         Cells(i, 16).Interior.ColorIndex = i + 28
  9.     Next
  10. End Sub

  11. '§@¥Î¡G¥Î¥H½s¿è"¤½¥q²M³æ"CÄ檺Àx¦s®æÃC¦â
  12. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  13.     Dim rng As Range
  14.     If Target.Count > 1 Then Exit Sub
  15.     Set rng = Application.Union([C:C], [O1:P28])
  16.     If Intersect(Target, rng) Is Nothing Then Exit Sub
  17.     If Target.Column = 3 Then
  18.         Target.Interior.ColorIndex = colorNum
  19.     Else
  20.         colorNum = Target.Interior.ColorIndex
  21.     End If
  22. End Sub
½Æ»s¥N½X
test2.gif
´ú¸ÕÀÉ®×.rar (381.48 KB)

TOP

¸g­ã¤j¦A¤T«ü¥¿, ²×©ó§¹¦¨
test.gif
Åã¥Ü¿é¤J­È¶ñº¡ÃC¦â2.rar (28.32 KB)

TOP

¦^´_ 23# yen956
Sorry, ¦^À³¿ù¥DÃD, ¹ï s7659109¤j¤j¤Î¬ÛÃöŪªÌ§¡«D±`©êºp,
¤w­«·s¶K¨ì¤U¦C¥DÃD¤¤, ©êºp!!
http://forum.twbts.com/viewthrea ... a=pageD1&page=3

TOP

TOP

¸g¹L­ã¤j¦A¤T«ü¾É, ²×©ó§¹¦¨¤F, ÁÂÁ­ã¤j.
test.gif

TOP

http://blog.xuite.net/hcm19522/twblog/205029860

TOP

Sorry,¥þ³¡¶K¦b sheet1 ¤¤´N¥i¥H¤F
¥ÎUnion´N¥i¥H¤F
  1. Public colorNum As Integer

  2. '¥ý°õ¦æ¦¹VBA¤@¦¸, ¥H«Ø¥ß¥N½Xªí(Sheet1)
  3. Sub ÃC¦â¥N½Xªí()
  4.     Dim i As Integer
  5.     For i = 1 To 56
  6.         Cells(i, 15) = i
  7.         Cells(i, 16).Interior.ColorIndex = i
  8.     Next
  9. End Sub

  10. '©|¥¼«Ø¥ß¥N½Xªí¥H«e, ¤£­n±Ò°Ê¦¹VBA
  11. '«Ø¥ß§¹¥N½Xªí«á§Y¥i±Ò°Ê¦¹VBA
  12. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  13.     Dim rng As Range
  14.     If Target.Count > 1 Then Exit Sub
  15.     Set rng = Application.Union([B:B], [P1:P56])
  16.     If Intersect(Target, rng) Is Nothing Then Exit Sub
  17.     If Target.Column = 16 Then
  18.         colorNum = Target.Interior.ColorIndex
  19.     Else
  20.         Target.Interior.ColorIndex = colorNum
  21.     End If
  22. End Sub
½Æ»s¥N½X
test.gif

TOP

¥»©«³Ì«á¥Ñ yen956 ©ó 2015-11-15 20:52 ½s¿è

1. ¦bModule1¤¤¶K¤W¤U¦CVBA
  1. Public colorNum As Integer

  2. '¥ý°õ¦æ¦¹VBA¤@¦¸, ¥H«Ø¥ß¥N½Xªí(Sheet1)
  3. Sub ÃC¦â¥N½Xªí()
  4.     Dim i As Integer
  5.     For i = 1 To 56
  6.         Sheets("Sheet1").Cells(i, 15) = i
  7.         Sheets("sheet1").Cells(i, 16).Interior.ColorIndex = i
  8.     Next
  9. End Sub
½Æ»s¥N½X
2. ¦bSheet2¤¤¤W¤U¦CVBA
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2.     If Target.Count > 1 Then Exit Sub
  3.     If Intersect(Target, [B:B]) Is Nothing Then Exit Sub
  4.     Target.Interior.ColorIndex = colorNum
  5. End Sub
½Æ»s¥N½X
3. ¦bSheet1¤¤¤W¤U¦CVBA
  1. '©|¥¼«Ø¥ß¥N½Xªí¥H«e, ¤£­n±Ò°Ê¦¹VBA
  2. '¥i¥ý±N Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  3. '§ï¦¨ Private Sub Worksheet_SelectionChange2(ByVal Target As Range)
  4. '«Ø¥ß§¹¥N½Xªí«á§Y¥i±Ò°Ê¦¹VBA, ¥Øªº¬O¨ú±o colorNum ªº­È
  5. '³Ì«á¦A¨ì sheet2 ¤¤,ÂIÄæBªº¦sÀx®æ, §Y¥i±o¨ì©Ò­nªºÃC¦â
  6. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  7.     If Target.Count > 1 Then Exit Sub
  8.     If Intersect(Target, [P1:P56]) Is Nothing Then Exit Sub
  9.     colorNum = Target.Interior.ColorIndex
  10. End Sub
½Æ»s¥N½X
´«¨¥¤§, ¥Î¨â­Ó Worksheet_SelectionChange ¨Ó¹F¦¨
test.gif

TOP

¤£¦n·N«ä~ÁÙ¤£¼ô±x¤¶­±ªº¾Þ§@~­«µo¤@¦¸^^"

¡y¦]¥»¨­¹ïÃC¦â¿ëÃѯà¤O¸û®z,¨ä±æ¥i¥H¦³¬ÛÀ³ªº¦â½X¥H¨Ñ¿ëÃÑ¡z

¦UÃC¦â¥N½X~
¦bA1¶ñ¤WÃC¦â¡A·Æ¹«Â÷¶}A1²¾¦Ü¥ô¤@Àx¦s®æ«á¡AB1¥iÅã¥Ü¸ÓA1ÃC¦âªº¥N½X¡C

Q1¡JW7¬°¦UÃC¦â¥N½X¤@Äýªí¡C

http://www.FunP.Net/469452

¶È¨Ñ°Ñ¦Ò¡C

TOP

        ÀR«ä¦Û¦b : ¡i»X½ªªº¦Û¥Ñ¡j¤H±`¦b¤°»ò³£¥i¥H¦Û¥Ñ¦Û¦bªº®É­Ô¡A«o³Q³oºØÀH¤ß©Ò±ýªº¦Û¥Ñ»X½ª¡AµêÂY®É¥ú¦Ó²@µLıª¾¡C
ªð¦^¦Cªí ¤W¤@¥DÃD