ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] Ãö©ó"¦b­ì¸ê®ÆªíºI¨ú¯S©w¸ê®Æ¶K¨ì·ssheetªº°ÝÃD"

¦^´_ 10# GBKEE

ÁÂÁÂGBKEE¤j:D ¡A§Ú¦A¸Õ¸Õ¬Ý¡C

TOP

¥»©«³Ì«á¥Ñ yagami12th ©ó 2012-2-27 12:07 ½s¿è

¦^´_ 10# GBKEE
¦^GBKEE¤j¡A¦]¬°¬Ý½d¨Òvba¤Þ¼Æªº³¡¥÷¤@ª½µLªk¤F¸Ñ¡A´N¬O¤U­±µ{¦¡½X¬õ¦â¦rÅ骺³¡¥÷¡A©Ò¥H·Q½Ð±ÐGBKEE¤jÃö©ó¤Þ¼Æªº°ÝÃD¡G

--------------------------------------------------------------------------------
Option Explicit
Dim Flag
Dim myRow As Integer
Dim newSheet As String

Sub addsheetVer2()
Static Num As Integer

    Sheets.Add after:=Sheets(Sheets.Count) '«ü¦W¤Þ¼Æ¡A¼Æ¸ÓexcelÀɦ³´X­Ósheet©ñ¦b³Ì¥kÃä
     Sheets(Sheets.Count).Select
     ActiveSheet.Name = "pick & num"
     
    Num = Num + 1
End Sub
----------------------------------------------------------------

Sub ChooseVer2(rowChoose, sheetName As String) '­ì¥ý¥u¦³¿é¤J¦C¸¹¡A²{¦b­n¥[¤W¤u§@ªíªº¦W¦r


If Worksheets(sheetName).Cells(rowChoose, 5).Value > 10 Then
     Flag = 1 '¥u¿ï¨ú«ü©wsheetªº¸ê®Æ°µ¿z¿ï
     

End If
End Sub
-------------------------------------------------------------------
Sub CopyPasteVer2(rowCopy, rowPaste, copySheet As String, pasteSheet As String) 'copy the row rowcopy in sheet with name "2330"
Dim myStr As String                                                             'and paste to the row rowpaste in the  sheet "pick"

    Sheets(copySheet).Select
     myStr = rowCopy & ":" & rowCopy
     Rows(myStr).Select
     Selection.Copy
     Sheets(pasteSheet).Select        <<<<<<<³o¸Ì¥X²{°}¦C¯Á¤Þ¿ù»~9¡A§â«_¸¹ªº¿ù»~§ó¥¿ÁÙ¬O¤@¼Ë~~
     myStr = "A" & rowPaste
     Range(myStr).Select
     ActiveSheet.Paste

End Sub
-----------------------------------------
Sub main3()

Dim myRange As Range
Dim myCell, i
Dim mySheet As String


Set myRange = Application.InputBox("Choose the days", Type:=8) 'À°§Ú¿ï¨ú§Ú­n¿z¿ïªº½d³ò
mySheet = InputBox("input the sheet name you analyze") '¿ï¾Ü¤u§@ªí

addsheetVer2                            '°õ¦æ¤W­z·s¼W¤u§@ªíªºµ{¦¡¡A¨C¦¸¼W¥[ªº¤£¤@¼ËmyRow = 1

For Each myCell In myRange              '¦b§Úªºmyrange¸Ì¹ï¨C¤@­Ómycell¡A¨Ó°µ¤U­±ªº¨Æ±¡
    Flag = 0                                 '¤£²Å¦X§Úªº­n¨D´N¸õ¨ì¤U¤@°é¥h¬Ý¬O§_¦³²Å¦X
    i = myCell.Row                  
   
    ChooseVer2 i, mySheet                            '¿ï¨ú¦æÀË´ú¬O§_²Å¦X§Ú³]ªº±ø¥ó
    If Flag = 1 Then                                             'choose¤lµ{§Ç§âflag§ïÅÜ
        CopyPasteVer2 i, myRow, mySheet, newSheet        
        myRow = myRow + 1
    End If
   
Next
End Sub

TOP

¦^´_ 12# yagami12th
  1. Option Explicit
  2. Dim Flag
  3. Dim myRow As Integer
  4. Dim newSheet As String
  5. Private Const XpasteSheet = "pick & num"
  6. 'Private Const "³]¬°¼Ò²Õªº¨p¥Î±`¼Æ  ¨ä­È¦p¦r­±©Ò¥Ü    ***«ü©w ¶K¤Wªº¤u§@ªí¦WºÙ
  7. Sub addsheetVer2()
  8.     Static Num As Integer
  9.     On Error GoTo AD:
  10.     With Sheets(XpasteSheet)
  11.         .Cells.Clear
  12.         Num = Num + 1
  13.     End With
  14.     Exit Sub
  15. AD:
  16.      Sheets.Add(after:=Sheets(Sheets.Count)).Name = XpasteSheet
  17.      ''«ü¦W¤Þ¼Æ¡A¼Æ¸ÓexcelÀɦ³´X­Ósheet©ñ¦b³Ì¥kÃä
  18.     Resume    'ªð¦^µ{§Ç¿ù»~³B
  19. End Sub
  20. Sub ChooseVer2(rowChoose, sheetName As String) '­ì¥ý¥u¦³¿é¤J¦C¸¹¡A²{¦b­n¥[¤W¤u§@ªíªº¦W¦r
  21.     If Worksheets(sheetName).Cells(rowChoose, 5) > 10 Then Flag = 1        '¥u¿ï¨ú«ü©wsheetªº¸ê®Æ°µ¿z¿ï
  22. End Sub
  23. Sub CopyPasteVer2(rowCopy, rowPaste, copySheet As String, pasteSheet) 'copy the row rowcopy in sheet with name "2330"
  24.     Dim myStr As String                                                             'and paste to the row rowpaste in the  sheet "pick"
  25.     Sheets(copySheet).Select
  26.     myStr = rowCopy & ":" & rowCopy
  27.     Rows(myStr).Select
  28.     Selection.Copy
  29.     Sheets(pasteSheet).Select
  30.     myStr = "A" & rowPaste
  31.     Range(myStr).Select
  32.     ActiveSheet.Paste
  33. End Sub
  34. Sub main3()
  35.     Dim i As Integer
  36.     Dim myRange As Range
  37.     Dim myCell
  38.     Dim mySheet As String
  39.     mySheet = InputBox("input the sheet name you analyze") '¿ï¾Ü¤u§@ªí
  40.     Set myRange = Application.InputBox("Choose the days", Type:=8)
  41.     'À°§Ú¿ï¨ú§Ú­n¿z¿ïªº½d³ò   ** ­n¿ï¨ú¾ã¦C  **
  42.     Set myRange = myRange.SpecialCells(xlCellTypeConstants)   '¿ï¨ú¾ã¦C¦³¸ê®Æªº½d³ò
  43.     addsheetVer2 '°õ¦æ¤W­z·s¼W¤u§@ªíªºµ{¦¡¡A¨C¦¸¼W¥[ªº¤£¤@¼Ë¡A¥i¥H°õ¦æ¤W­±¼gªº¦n´X­Ó°Æµ{¦¡¡A¥i¥HÅý¨C­Óµ{¦¡¤À¤u¦X§@¡A²Õ¦X¦b¤@°_
  44.     myRow = 1
  45.     For Each myCell In myRange '¦b§Úªºmyrange¸Ì¹ï¨C¤@­Ómycell¡A¨Ó°µ¤U­±ªº¨Æ±¡
  46.         i = myCell.Row
  47.         Flag = 0 '¤£²Å¦X§Úªº­n¨D´N¸õ¨ì¤U¤@°é¥h¬Ý¬O§_¦³²Å¦X
  48.         ChooseVer2 i, mySheet 'ÀË´ú²Ä20¦æ¬O§_²Å¦X§Ú³]ªº±ø¥ó
  49.         If Flag = 1 Then
  50.             CopyPasteVer2 i, myRow, mySheet, XpasteSheet '¦b«ü©wªº¤u§@ªí§@¿z¿ï«á¶K¹L¥h¡A²Å¦X³]©w±ø¥ó¡A¶K¨ì·sªº¤u§@ªí¡A¦]¬°¤£¬O¥u¦³²Ä¤G¤Q¦æ¡A©Ò¥H­n¼g°j°é
  51.             myRow = myRow + 1
  52.         End If
  53.     Next
  54. End Sub
½Æ»s¥N½X

TOP

¦^´_ 13# GBKEE

¤Ó·PÁÂGBKEE¤j¤F:D ¡A¦ý¹ï©óGOTO¤èªkÁÙ¨S¥Î¹L¡A­n¬d¤@¤U¡C

TOP

        ÀR«ä¦Û¦b : ¤p¨Æ¤£°µ¡B¤j¨ÆÃø¦¨¡C
ªð¦^¦Cªí ¤W¤@¥DÃD