- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2018-6-11 14:09 ½s¿è
¦^´_ 2# newstarmoon
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim AR(), Ar1(), Ar2(), i As Long, ii As Long, iii As Long, Msg As String
- Dim xRow As Integer
- Ar1 = Array("a", "b", "d") '§AªºCÄæÁôÂäF
- ReDim AR(1 To UBound(Ar1) + 1)
- Sheets("¹Bºâ").UsedRange.Clear
- With Sheets("¤u§@ªí")
- For i = 1 To UBound(Ar1) + 1
- ii = IIf(.Cells(Rows.Count, Ar1(i - 1)).End(xlUp).Row > ii, .Cells(Rows.Count, Ar1(i - 1)).End(xlUp).Row, ii)
- '¦pªG¬Y¤@¦Cªº¸ê®Æ¦³100¦æ¡A¦Ó²Ä5¦æ¬OªÅ¥Õ
- '***¥²¶·§ä¥X©Ò¦³Äæ¦ì¤¤³Ì«á¸ê®Æ¦³ªº¦C¸¹ ***
- Next
- For i = 1 To UBound(Ar1) + 1
- AR(i) = Application.WorksheetFunction.Transpose(.Range(Ar1(i - 1) & "1").Resize(ii).Value)
- Next
- End With
- With Sheets("Ãħ÷ÀÉ")
- Ar1 = .Range(.[A5], .[A5].End(xlDown)).Resize(, 5).Value
- For i = 1 To .[A5].End(xlDown).Row - 4
- Ar1(i, 5) = .Range("DK" & i + 4) '**¥[¤J"DK"Äæ
- Next
- End With
- For i = 2 To UBound(AR(1)) 'ÃÄ¥N
- '**************************
- '"¤u§@ªí"
- 'AR(1)(i)=>ÃÄ¥N AR(2)(i)=>Ãijæ¦W AR(3)(i)=>°·«O½X
- '**************************
- '"Ãħ÷ÀÉ"
- 'Ar1(ii, 1)=>ÃÄ¥N Ar1(ii, 2)=>¥N¸¹ Ar1(ii, 3)=>°·«O½X Ar1(ii, 4)=>ÃĦW
- 'Ar1(ii, 5)=>DK
- '**************************
-
- Msg = ""
- For ii = 1 To UBound(Ar1)
- If AR(1)(i) <> "" And Ar1(ii, 1) <> AR(1)(i) Then 'ÃÄ¥N¤£¬Û¦P
- 'InStr(Ar1(ii, 5), (AR(3)(i))) ->¬d¬Ý¦³µL¬Û¦P°·«O½X
- If UCase(Ar1(ii, 4)) = UCase(AR(2)(i)) Or UCase(Ar1(ii, 3)) = UCase(AR(3)(i)) Or InStr(Ar1(ii, 5), (AR(3)(i))) Then
- Msg = Msg & IIf(Msg <> "", ",", "") & ii '¤ñ¹ï¨ì±a¤J
- End If
- End If
- Next
- If Msg <> "" Then
- With Sheets("¹Bºâ").Cells(Rows.Count, "A").End(xlUp)
- xRow = IIf(.Row = 1, 0, 2)
- Ar2 = Application.Index(Application.WorksheetFunction.Transpose(AR), 1)
- .Offset(xRow).Resize(, UBound(Ar2)) = Ar2
- Ar2 = Application.Index(Application.WorksheetFunction.Transpose(AR), i)
- .Offset(xRow + 1).Resize(, UBound(Ar2)) = Ar2
- Ar2 = Array("ÃÄ¥N", "¥N¸¹", "°·«O½X", "ÃĦW", "DKÄæ")
- .Offset(xRow + 2).Resize(, UBound(Ar2) + 1) = Ar2
- End With
- With Sheets("¹Bºâ").Cells(Rows.Count, "A").End(xlUp).Offset(1)
- For iii = 0 To UBound(Split(Msg, ","))
- Ar2 = Application.Index(Ar1, Split(Msg, ",")(iii))
- .Offset(iii).Resize(, UBound(Ar2)) = Ar2
- Next
- End With
- End If
- Next
- End Sub
½Æ»s¥N½X |
|