- ©«¤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 ©ó 2012-2-15 14:42 ½s¿è
¦^´_ 13# owen9399
§AªþÀɤ¤ Sheet("¥æ³f¸ê®Æ®w") VBA ªºCodename ¬° Sheet2
Sheet("¶i³f¸ê®Æ®w") VBA ªºCodename ¬° Sheet3
Sheet1 ªº¨Æ¥óµ{¦¡½X :¿é¤J§Ç¸¹ ©Î¥Î¤U©Ô¦¡¿ï³æ ª½±µ¨q¥X¤½¥q¦WºÙ- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim xM
- If Intersect(Target, Range("A2:A11")) Is Nothing And Intersect(Target, Range("J2:J11")) Is Nothing _
- Or Target(1) = "" Or Target.Count > 1 Then Exit Sub
- xM = Application.Match(Target, [¤½¥q§Ç¸¹].Columns(1), 0)
- Target(1).Cells(1, 2) = [¤½¥q§Ç¸¹].Cells(xM, 2)
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- On Error Resume Next
- [§Ç¸¹].Validation.Delete
- If Intersect(Target, Range("A2:A11")) Is Nothing And Intersect(Target, Range("J2:J11")) Is Nothing _
- Then Exit Sub
- Range("Q2", [Q2].End(xlDown)).Resize(, 2).Name = "¤½¥q§Ç¸¹"
- Target.Name = "§Ç¸¹"
- With [§Ç¸¹].Validation
- .Delete
- .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
- Operator:=xlBetween, Formula1:="=" & [¤½¥q§Ç¸¹].Columns(1).Address
- End With
- End Sub
½Æ»s¥N½X Module1ªºµ{¦¡½X- Sub «ö¶s1_Click()
- Dim Rng As Range
- Set Rng = Sheet1.Range("A2:G11").SpecialCells(xlCellTypeVisible)
- With Sheet2.Range("A65536").End(xlUp).Offset(1)
- .Resize(Rng.Rows.Count, Rng.Columns.Count) = Rng.Value
- .CurrentRegion.Borders.LineStyle = 1 'µe½u
- .CurrentRegion.Borders.ColorIndex = 1 '¤W¦â
- End With
- Rng.ClearContents
- End Sub
- Sub «ö¶s2_Click()
- Dim Rng As Range
- Set Rng = Sheet1.Range("J2:N11").SpecialCells(xlCellTypeVisible)
- With Sheets("¶i³f¸ê®Æ®w").Range("A65536").End(xlUp).Offset(1)
- .Resize(Rng.Rows.Count, Rng.Columns.Count) = Rng.Value
- .CurrentRegion.Borders.LineStyle = 1
- .CurrentRegion.Borders.ColorIndex = 1
- End With
- Rng.ClearContents
- End Sub
- Sub «ö¶s3_Click()
- Dim Rng As Range, S As String, xi As Integer
- Dim Sh As Worksheet
- Set Sh = Sheets("¤é³øªí") ' ¤é³øªí
- Sh.Cells.Clear
- With Sheets("¥æ±b¸ê®Æ®w")
- If .AutoFilterMode Then .AutoFilterMode = False '¨ú®ø¿z¿ï
- .Range("a1").AutoFilter '[¦Û°Ê¿z¿ï] ¿z¿ï¥X¤@Ó²M³æ
- Set Rng = .AutoFilter.Range.Columns(6).Cells '[¦Û°Ê¿z¿ï]ªº²Ä6Äæ
- For xi = 2 To Rng.Count '³B¸Ì: ²Ä¤GÄæ ³æ¤¸®æ
- If InStr(S, "," & Rng(xi) & ",") = False Then 'Àˬd Àx¦s®æ ¬O§_¤w¥X²{¹L
- .Range("a1").AutoFilter Field:=6, Criteria1:=Rng(xi).Text '¨S¥X²{: «ü©w¬°¿z¿ïÈ
- S = S & "," & Rng(xi) & "," '¥[¤J¤w¥X²{¹Lªº¦r¦ê¤¤
- .UsedRange.SpecialCells(xlCellTypeVisible).Copy Sh.Cells(Rows.Count, "b").End(xlUp).Offset(2) '½Æ»s: ¸ê®Æªí¤¤¿z¿ï¥Xªº¸ê®Æ
- Sh.Cells(Rows.Count, "b").End(xlUp).Offset(2).CurrentRegion.Borders.LineStyle = 1
- Sh.Cells(Rows.Count, "b").End(xlUp).Offset(2).CurrentRegion.Borders.ColorIndex = 1
- End If
- Next
- .AutoFilterMode = False '¨ú®ø¿z¿ï
- End With
- Sh.Activate
- End Sub
½Æ»s¥N½X |
|