- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
³sÄò¨â¦¸³£¶K¿ù¦a¤è, ¹ê¦b¤£¥iì½Ì!!
·Q¶Kªº¬O³oÓ!!
¸Õ¸Õ¬Ý!!
sheet1(³]³Æ¦Cªí)ªºVBA Code¦p¤U:- Option Explicit
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim rngA As Range, rngB As Range, foundCel As Range
- Dim lastRow As Long
- If Target.Count > 1 Then Exit Sub '¦pªG¤@¦¸Change¤Ó¦h®æ´NÂ÷¶}
- lastRow = Sheets("¤½¥q²M³æ").Cells(Rows.Count, 2).End(xlUp).Row
- Set rngA = Sheets("¤½¥q²M³æ").Range("B2:B" & lastRow & "") '³]©w "¤½¥q²M³æ" ªº½d³òµ¹ rngA
- lastRow = Cells(Rows.Count, 2).End(xlUp).Row
- Set rngB = Range("B2:B" & lastRow & "") '³]©w "³]³Æ¦Cªí" ªº½d³òµ¹ rngB
- If Not Intersect(Target, rngB) Is Nothing Then
- Set foundCel = rngA.Find(Target, lookat:=xlWhole) 'rngA ¤¤´M§ä Target
- If Not foundCel Is Nothing Then '¦³§ä¨ì
- Target.Offset(0, -1).Resize(1, 11).Interior.ColorIndex = _
- foundCel.Offset(0, 1).Interior.ColorIndex
- ' Else
- '«Øij "³]³Æ¦Cªí" ªº "¨Ï¥Î¤½¥q" ¥Î ÅçÃÒ²M³æ ¿é¤J
- '«h¦¹³B´N¤£¥²Àˬd¿é¤J¬O§_¦³¿ù»~, ´«¨¥¤§, ´N¨S¦³ Else ³o¤@¬q
- '¤S ÅçÃÒ²M³æ ¦rÅé«Ü¤p¤S¤£¯à§ï, ¤£¾A¦X®zµøªÌ,
- '«Øij "³]³Æ¦Cªí" ¾ã¶¥þ³¡§ï¥Î¤p¦rÅé, ¦A©ñ¤jÀ˵ø¤ñ¨Ò
- End If
- End If
- End Sub
½Æ»s¥N½X sheet2(¤½¥q²M³æ)ªºVBA Code¦p¤U:- Option Explicit
- Public colorNum As Integer
- '¥ý°õ¦æ¦¹VBA¤@¦¸, ¥H«Ø¥ß¥N½Xªí
- Sub ÃC¦â¥N½Xªí()
- Dim i As Integer
- For i = 1 To 28
- Cells(i, 15).Interior.ColorIndex = i
- Cells(i, 16).Interior.ColorIndex = i + 28
- Next
- End Sub
- '§@¥Î¡G¥Î¥H½s¿è"¤½¥q²M³æ"CÄ檺Àx¦s®æÃC¦â
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim rng As Range
- If Target.Count > 1 Then Exit Sub
- Set rng = Application.Union([C:C], [O1:P28])
- If Intersect(Target, rng) Is Nothing Then Exit Sub
- If Target.Column = 3 Then
- Target.Interior.ColorIndex = colorNum
- Else
- colorNum = Target.Interior.ColorIndex
- End If
- End Sub
½Æ»s¥N½X
´ú¸ÕÀÉ®×.rar (381.48 KB)
|
|