- ©«¤l
- 88
- ¥DÃD
- 13
- ºëµØ
- 0
- ¿n¤À
- 104
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN7
- ³nÅ骩¥»
- OFFICE2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-1-3
- ³Ì«áµn¿ý
- 2017-12-31
|
¥»©«³Ì«á¥Ñ yagami12th ©ó 2012-2-26 22:27 ½s¿è
¦^´_ 4# Hsieh
¥ÎloopªºÀɮק令¥\¤F¡Aì¨Ó¬O¦³¨Ç«ü©w¦WºÙ¤£¥Î¥Î"" ¥]°_¨Ó
¦pªþ¥ó¡G
4finish.rar (818.72 KB)
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
newSheet = "pick" & Num
ActiveSheet.Name = newSheet
Num = Num + 1
End Sub
Sub ChooseVer2(rowChoose, sheetName As String) 'ì¥ý¥u¦³¿é¤J¦C¸¹¡A²{¦bn¥[¤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
myStr = "A" & rowPaste
Range(myStr).Select
ActiveSheet.Paste
End Sub
Sub main3()
Dim i As Integer
Dim myRange As Range
Dim myCell
Dim mySheet As String
mySheet = InputBox("input the sheet name you analyze") '¿ï¾Ü¤u§@ªí
Set myRange = Application.InputBox("Choose the days", Type:=8) 'À°§Ú¿ï¨ú§Ún¿z¿ïªº½d³ò
addsheetVer2 '°õ¦æ¤Wz·s¼W¤u§@ªíªºµ{¦¡¡A¨C¦¸¼W¥[ªº¤£¤@¼Ë¡A¥i¥H°õ¦æ¤W±¼gªº¦n´XӰƵ{¦¡¡A¥i¥HÅý¨CÓµ{¦¡¤À¤u¦X§@¡A²Õ¦X¦b¤@°_
myRow = 1
For Each myCell In myRange '¦b§Úªºmyrange¸Ì¹ï¨C¤@Ómycell¡A¨Ó°µ¤U±ªº¨Æ±¡
i = myCell.Row
Flag = 0 '¤£²Å¦X§Úªºn¨D´N¸õ¨ì¤U¤@°é¥h¬Ý¬O§_¦³²Å¦X
ChooseVer2 i, mySheet 'ÀË´ú²Ä20¦æ¬O§_²Å¦X§Ú³]ªº±ø¥ó
If Flag = 1 Then
CopyPasteVer2 i, myRow, mySheet, newSheet '²Å¦X³]©w±ø¥ó¡A¶K¨ì·sªº¤u§@ªí¡A¦]¬°¤£¬O¥u¦³²Ä¤G¤Q¦æ¡A©Ò¥Hn¼g°j°é
myRow = myRow + 1
End If
Next
End Sub
Sub main4()
Dim i As Integer
Dim mySheet As String
mySheet = InputBox("input the sheet name you analyze") '¿ï¾Ü¤u§@ªí
addsheetVer2 '°õ¦æ¤Wz·s¼W¤u§@ªíªºµ{¦¡¡A¨C¦¸¼W¥[ªº¤£¤@¼Ë¡A¥i¥H°õ¦æ¤W±¼gªº¦n´XӰƵ{¦¡¡A¥i¥HÅý¨CÓµ{¦¡¤À¤u¦X§@¡A²Õ¦X¦b¤@°_
myRow = 1: i = 2
Do While Worksheets(mySheet).Cells(i, 1) <> "" '¦b«ü©wªº¤u§@ªí¸Ì²Ä¤@¦æ©¹¤U±½¥un¤£¬OªÅ¥Õ®æ´N°õ¦æ¤U±ªºµ{¦¡½X
Flag = 0 '¤£²Å¦X§Úªºn¨D´N¸õ¨ì¤U¤@°é¥h¬Ý¬O§_¦³²Å¦X
ChooseVer2 i, mySheet 'ÀË´ú¬O§_²Å¦X§Ú³]ªº±ø¥ó
If Flag = 1 Then
CopyPasteVer2 i, myRow, mySheet, newSheet '²Å¦X³]©w±ø¥ó¡A¶K¨ì·sªº¤u§@ªí¡A¦]¬°¤£¬O¥u¦³²Ä¤G¤Q¦æ¡A©Ò¥Hn¼g°j°é
myRow = myRow + 1
End If
i = i + 1
Loop
End Sub |
|