- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 16
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-14
|
¦p¦óÅý½s¸¹¦Û°Ê²£¥Í
¸ß¨D¦U¦ì¤j¤jÀ°¦£
sheau-lan µoªí©ó 2015-6-11 08:44
§Aªº½d¨ÒÀɦ³¨Ç¦a¤èÅÞ¿è©Ê¤£¤@P,
³o¸Ì¥u¯à¥ý¨Ì§Ú²z¸Ñªº³W«h¨Ó¸Õ°µ.
1.¨CÓ Range ¶¡©T©w¥u¯d 4 ªº¿¼ÆªºªÅ¥Õ¦C,
¶W¹L¥B¥¼¹F 4 ªº¿¼ÆªºªÅ¥Õ¦CµL±ø¥ó§R°£,
¨C¦h 4 ӪťզC ³W®æªº§Ç¸¹¥[ 1
2.¥u¦Ò¼{Åܧó «~¸¹ ©Ò¦b¦C¦Û°Ê½s¸¹ ³W®æ-^¤å¦r,
¹ï©ó¨ä¤U¸ê®Æ¨Ã¥¼°µ«·s½s¸¹ªº³B²z.- Private Sub Worksheet_Change(ByVal Target As Range)
- On Error GoTo 99
- Dim TG As Range
- With Target
- If .Row >= 3 And .Column = 1 Then
- If .Value = "" Then
- 98: .Offset(0, 2) = ""
- .Offset(0, 3) = ""
- .Offset(0, 5) = ""
- .Offset(0, 6) = ""
-
- Else: Set TG = Sheet7.[H3:H9999].Find("*" & .Value & "*", , , xlWhole)
- If TG Is Nothing Then GoTo 98
- .Offset(0, 2) = TG.Offset(0, -6).Value
- TG2 = .Offset(0, 2).Value
- .Offset(0, 3) = TG.Offset(0, -3).Value
- .Offset(0, 9) = TG.Offset(0, -2).Value
- .Offset(0, 5) = Application.VLookup(TG2, Sheet15.[A4:H9999], 8, False)
- If IsError(.Offset(0, 5).Value) Then .Offset(0, 5) = ""
- .Offset(0, 6) = TG.Offset(0, 1).Value
- Dim N%, N1%, S1$, C%, S2$
- N = 0
- Set TG = .Offset(-1, 7)
- While TG = ""
- Set TG = TG.Offset(-1)
- N = N + 1
- Wend
-
- N1 = Mid(TG, 2, Len(TG) - 3)
- S1 = Right(TG, 1)
-
- C = 0
- S2 = TG
- While TG = S2
- Set TG = TG.Offset(-1)
- C = C + 1
- Wend
-
- If N > 3 Then
- N1 = N1 + Int((N - 3) / 4) + 1
- S1 = "A"
- With Range(.Offset(0), .Offset(, 9)).Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 37
- .Weight = xlHairline
- End With
- N = N - (Int(N / 4) * 4)
- Else
- If C > 3 Then S1 = Chr(Asc(S1) + 1)
- End If
- Application.EnableEvents = False
- .Offset(, 7) = "M" & N1 & "-" & S1
- If N > 0 And N < 4 Then
- Range(Rows(.Row - 1), Rows(.Row - N)).Delete
- .Offset(1).Select
- End If
- Application.EnableEvents = True
- End If
- End If
- End With
- 99
- End Sub
½Æ»s¥N½X |
|