VBA¦p¦ó±N¤£¦P¸ê®Æªº°Ï°ì§ì¥X¤ÀÃþ?
- ©«¤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
|
¦^´_ 3# handsometrowa
¤£n³à®ð,§Ú¦³³o¯à¤O¬°§A¸Ñµª,¬O¶O¤F«Ü¦h®É¶¡©Ò¿i½m¥X¨Óªº.
¦³°ÝÃDÅwªï´£°Ý,¦h¬Ý,¦h½m²ß½d¨Ò,·|¶i¨Bªº
Sub Main()
«Ø¥ß¸ê®Æ®w½d³ò
Sub ¿z¿ïµ{¦¡(Sh As String)
¨Ì¶Ç°eªº°Ñ¼ÆSh(¤u§@ªí¦WºÙ)«ü©w¨ì¤u§@ªíª«¥ó: With Sheets(Sh)
×q¶i¶¥¿z¿ï, CriteriaRange[¿z¿ï·Ç«h],Äæ¦ì¦WºÙ( "¨ì´Á¤ë¥÷","¶R½æÅv" ),
[¿z¿ï·Ç«h],Äæ¦ì ³]¥ß±ø¥ó .[L2] = IIf(Sh = "¶RÅv", "Call", "Put")
Sub ¤ë¥÷«´¬ù¿z¿ïµ{¦¡(Sh As String)
¨Ì·ÓSh="½æÅv"©Î¬OSh="¶RÅv",·s¼W¦P¤@¤ë¥÷ªº«´¬ùªº¤u§@ªí |
|
|
|
|
|
|
- ©«¤l
- 82
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 112
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- WIN7
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-1-3
- ³Ì«áµn¿ý
- 2020-9-21
|
²`²`ªº·PÁª©¥D¡A»¡¯uªº§Ú¬Ý¨ìªº®ÉÔ©ü¤F....
§Ú¸£¤¤ªº·Qªk«ç»ò¼g¥X¨Ó³o»ò½ÆÂø
§Úªº¥\¤O¯uªºÂ÷³oÓ¶¥¬q¦n»·¦n»·...
¥i§_½Ðª©¥D¸ò§Ú¸ÑÄÀ¤@¤U ¤jP¤Wªº¬yµ{
±z¬O«ç»òºc«ä ¤S«ç»ò³B²z³o¨Ç°ÝÃDªº¥ý¨Ó«á¨ìªº@@? |
|
|
|
|
|
|
- ©«¤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
|
¦^´_ 1# handsometrowa
¸ê®Æ°Ï°ì Åܦ¨¬õ¦âªº¦r¼Ë ,¿ý»s¥¨¶°¸Õ¸Õ¬Ý- Option Explicit
- Dim Rng As Range, AR()
- Sub Main()
- AR = Array("¨ì´Á¤ë¥÷", "¼i¬ù»ù", "¶R½æÅv", "¦¨¥æ¶q", "¥¼¨R¾P«´¬ù¶q")
- With Sheets("¿ï¾ÜÅvÁ`ªí")
- .[L4:M4] = Array("¦¨¥æ¶q", "¥¼¨R¾P«´¬ù¶q") '"*¦¨¥æ¶q" ,"*¥¼¨R¾P'¸ê®Æ®wÄæ"*" ¶i¶¥¿z¿ï¦³·|¦³¿ù»~
- Set Rng = .Range("B4:Q" & .[B4].End(xlDown).Row) '¸ê®Æ®w
- ¿z¿ïµ{¦¡ "¤ÀÃþ¤@"
- ¿z¿ïµ{¦¡ "½æÅv"
- ¿z¿ïµ{¦¡ "¶RÅv"
- .Activate
- End With
- End Sub
- Private Sub ¿z¿ïµ{¦¡(Sh As String) 'SH°Ñ¼Æ¬°¦r¦ê«¬ºA :¤u§@ªí¦WºÙ
- Dim T As String
- With Sheets(Sh)
- .Cells.Clear 'Àx¦s®æ:²M°£
- .[L1].Value = AR(0) '¶i¶¥¿z¿ï: CriteriaRange,·Ç«hÄæ¦ì¦WºÙ("¨ì´Á¤ë¥÷")
- .[A1:E1].Value = AR '¶i¶¥¿z¿ï: CopyToRange,½Æ»s¨ìÀx¦s®æªºÄæ¦ì¦WºÙ
-
- If Sh = "½æÅv" Or Sh = "¶RÅv" Then
- .[L1].Value = AR(2) '¶i¶¥¿z¿ï: CriteriaRange,·Ç«hÄæ¦ì¦WºÙ("¶R½æÅv")
- .[L2] = IIf(Sh = "¶RÅv", "Call", "Put") '¶i¶¥¿z¿ï:·Ç«hÄæ¦ì ³]¥ß±ø¥ó
- End If
- Rng.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=.[L1:L2], CopyToRange:=.[A1:E1], Unique:=True
- .[L1:L2] = "" 'Unique:=True ¶È¿z¿ï°ß¤@ªº°O¿ý
- If Sh <> "½æÅv" And Sh <> "¶RÅv" Then
- .Rows(2).Delete '¸ê®Æ®w²Ä2¦C¬° (¶g§O) ¤£»Ýn§R±¼
- Else
- ¤ë¥÷«´¬ù¿z¿ïµ{¦¡ Sh
- End If
- End With
- End Sub
- Private Sub ¤ë¥÷«´¬ù¿z¿ïµ{¦¡(Sh As String)
- Dim R As Range
- On Error GoTo ER: 'µ{¦¡¿ù»~³B¸Ì:¤ë¥÷«´¬ù¶RÅvªº¤u§@ªí,¦p¤£¦s¦b·|¦³¿ù»~.
- With Sheets(Sh)
- .Range("A:A").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Cells(1, .Columns.Count), Unique:=True
- '¿z¿ï [¨ì´Á¤ë¥÷]¦b¤u§@ªí³Ì¥kºÝªºÄæ¦ì
- For Each R In .Range(.Cells(2, .Columns.Count), .Cells(2, .Columns.Count).End(xlDown)) '³Ì¥kºÝªºÄæ¦ìªº[¨ì´Á¤ë¥÷]
- .Range("A1").AutoFilter Field:=1, Criteria1:=R '¦Û°Ê¿z¿ï: AÄæ ·Ç«h= [¨ì´Á¤ë¥÷]
- .Range("A:E").Copy Sheets(R & Sh).[A1] '¤£²Å¦X·Ç«hªº¸ê®Æ·|ÁôÂñ¼
- Next
- End With
- Exit Sub 'Â÷¶}³oµ{§Ç
- ER:
- If Err.Number = 9 Then '¤ë¥÷«´¬ù¶RÅvªº¤u§@ªí
- Sheets.Add Sheets(Sheets.Count) '·s¼W¤u§@ªí
- ActiveSheet.Name = R & Sh '¤u§@ªí:©R¦W
- Resume '¦^¨ìµ{¦¡¿ù»~ÂI
- End If
- MsgBox Err.Description & Err.Number '§iª¾:¤£¬O¤u§@ªí¤£¦s¦b·|¦³¿ù»~.
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|