- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
¦^´_ 2# boomf2 - Sub ¦Û°Ê·s¼W¤é¤u§@ï§ó·s()
- ¥»ÀɦW = ActiveWorkbook.Name
- ¥»¸ô®| = ActiveWorkbook.Path
- '***********************************************§ä¥Xa©±001¦ì¸m***********************************
- For aaa = 1 To 20
- On Error Resume Next
- ©±¦WÄæ¦ì = Sheets("Total").Rows(aaa).Find(What:="A©±001", LookIn:=xlValues, SearchDirection:=xlPrevious).Column
- On Error GoTo 0
- Next
- For aaa = 1 To ©±¦WÄæ¦ì
- On Error Resume Next
- ©±¦W¦C¦ì = Sheets("Total").Columns(aaa).Find(What:="A©±001", LookIn:=xlValues, Lookat:=xlWhole, SearchDirection:=xlPrevious).Row
- On Error GoTo 0
- Next
- '***********************************************§ä¥Xa©±001¦ì¸m***********************************
- '***********************************************§ä¥X³Ì«á¤@¶¡©±¦ì¸m***********************************
- ©±¦W³Ì«áÄæ¦ì = Sheets("Total").Rows(©±¦W¦C¦ì).Find(What:="*", LookIn:=xlValues, Lookat:=xlWhole, SearchDirection:=xlPrevious).Column
- '***********************************************§ä¥X³Ì«á¤@¶¡©±¦ì¸m***********************************
- '***********************************************§ä¥X²£«~¼Æ¶q***********************************
- ²£«~codeÄæ = Sheets("Total").Rows(©±¦W¦C¦ì).Find(What:="²£«~CODE", LookIn:=xlValues, Lookat:=xlWhole, SearchDirection:=xlPrevious).Column
- ²£«~code¦C = Sheets("Total").Columns(²£«~codeÄæ).Find(What:="*", LookIn:=xlValues, SearchDirection:=xlPrevious).Row
- ²£«~Á`¼Æ = ²£«~code¦C - ©±¦W¦C¦ì
- '***********************************************§ä¥X²£«~¼Æ¶q***********************************
- '***********************************************Åý¤§«á°j°é¥Î***********************************
- ²£«~°_©l¦C©w¦ì = ©±¦W¦C¦ì + 1
- ²£«~µ²§ô¦C©w¦ì = ²£«~code¦C
- '***********************************************Åý¤§«á°j°é¥Î***********************************
- ''*************************¨ä¥L¸ê°T*************************
- ¤é´Á¼È¦s = Workbooks(¥»ÀɦW).Sheets("Total").[G1]
- ''*************************¨ä¥L¸ê°T*************************
- '*************************¬y¤ô¸¹°j°é°_©lÈ*************************
- ¬y¤ô = 1
- '*************************¬y¤ô¸¹°j°é°_©lÈ*************************
- While ©±¦WÄæ¦ì < ©±¦W³Ì«áÄæ¦ì + 1
- ©±¦W = Workbooks(¥»ÀɦW).Sheets("Total").Cells(©±¦W¦C¦ì, ©±¦WÄæ¦ì)
- ¥XÀɸ¹ = "order" & ¬y¤ô
- Set nX = Workbooks.Add
- Application.DisplayAlerts = False
- ActiveWorkbook.Sheets(3).Delete
- ActiveWorkbook.Sheets(2).Delete
- ActiveWorkbook.Sheets(1).Name = ©±¦W
- ²£«~¹Bºâ¦C = ²£«~°_©l¦C©w¦ì
- ²£«~°±ºâ¦C = ²£«~µ²§ô¦C©w¦ì
- orderrow = 1
- While ²£«~¹Bºâ¦C < ²£«~°±ºâ¦C + 1
- If Workbooks(¥»ÀɦW).Sheets("Total").Cells(²£«~¹Bºâ¦C, ©±¦WÄæ¦ì) <> "" Then
-
- ActiveWorkbook.Sheets(1).Cells(orderrow, 1) = "DK"
- ActiveWorkbook.Sheets(1).Cells(orderrow, 3) = ¤é´Á¼È¦s
- ActiveWorkbook.Sheets(1).Cells(orderrow, 4) = "DN"
- ActiveWorkbook.Sheets(1).Cells(orderrow, 5) = "B99"
- ActiveWorkbook.Sheets(1).Cells(orderrow, 6) = "©±¦W"
- ActiveWorkbook.Sheets(1).Cells(orderrow, 7) = Workbooks(¥»ÀɦW).Sheets("Total").Cells(²£«~¹Bºâ¦C, ²£«~codeÄæ).Value
- ActiveWorkbook.Sheets(1).Cells(orderrow, 8) = Workbooks(¥»ÀɦW).Sheets("Total").Cells(²£«~¹Bºâ¦C, ²£«~codeÄæ + 3).Value
- ActiveWorkbook.Sheets(1).Cells(orderrow, 9) = Workbooks(¥»ÀɦW).Sheets("Total").Cells(²£«~¹Bºâ¦C, ©±¦WÄæ¦ì)
- orderrow = orderrow + 1
- End If
-
-
- ²£«~¹Bºâ¦C = ²£«~¹Bºâ¦C + 1
- Wend
- nX.SaveAs ThisWorkbook.Path & "/" & ¥XÀɸ¹ & ©±¦W
- nX.Close
- ¬y¤ô = ¬y¤ô + 1
- ©±¦WÄæ¦ì = ©±¦WÄæ¦ì + 1
- Wend
- End Sub
½Æ»s¥N½X |
|