- ©«¤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
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-3-30 16:28 ½s¿è
¦^´_ 23# coafort
ÁÂÁ½׾Â,ÁÂÁ«e½ú
«á¾Ç¼ÒÀÀ±¡¹Ò,¾Ç²ßVBAÀx¦s®æ¶°.IJµo»P¦r¨åªº¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò
Xl0000797_20230330_3.zip (34.73 KB)
°õ¦æ«e:
¿é¤J«á°õ¦æµ²ªG:
¤u§@ªí¼Ò²Õ:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With Target
If .Row < 3 Or .Value = "" Or .Count > 1 Then Exit Sub
If .Column Mod 5 <> 1 Then Exit Sub
Cancel = True
Call Åܦr¦â_¦hÓ¦PªÑ¦W
If Y(.Value & "|") > 1 Then Y(.Value).Interior.ColorIndex = 4
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Row < 3 Or .Count > 1 Then Exit Sub
If .Column Mod 5 <> 0 Then Exit Sub
Call Åܦr¦â_¦hÓ¦PªÑ¦W
If Y(.Offset(0, -4) & "|") > 1 Then
Y(.Offset(0, -4) & "").Interior.ColorIndex = 4
Application.EnableEvents = False
Y(.Offset(0, -4) & "/").Value = .Value
Application.EnableEvents = True
Application.Goto Y(.Offset(0, -4) & "/")
End If
End With
End Sub
Module1:
Option Explicit
Public Y
Sub Åܦr¦â_¦hÓ¦PªÑ¦W()
Dim Brr, Crr, C&, i&, X&, xR, R&, T, V, Z, Ad
Set Y = CreateObject("Scripting.Dictionary")
ActiveSheet.UsedRange.Offset(2).Font.ColorIndex = 1
ActiveSheet.UsedRange.Offset(2).Interior.ColorIndex = xlNone
Brr = ActiveSheet.UsedRange
Set Y(1) = [B1]
For C = 1 To UBound(Brr, 2) Step 5
For R = 3 To UBound(Brr)
Y(Brr(R, C) & "|") = Y(Brr(R, C) & "|") + 1
If Y(Brr(R, C) & "|") = 1 Then
Set Y(Brr(R, C)) = Cells(R, C)
Set Y(Brr(R, C) & "/") = Cells(R, C + 4)
GoTo PASS
End If
If Y(Brr(R, C) & "|") = 2 Then
Set Y(1) = Union(Y(1), Y(Brr(R, C)))
End If
Set Y(1) = Union(Y(1), Cells(R, C))
Set Y(Brr(R, C)) = Union(Y(Brr(R, C)), Cells(R, C))
Set Y(Brr(R, C) & "/") = Union(Y(Brr(R, C) & "/"), Cells(R, C + 4))
PASS:
Next
Next
Y(1).Font.ColorIndex = 5
End Sub |
|