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

[µo°Ý] ½Ð°Ý­n¦p¦ó²¤Æ/§ó§ïVBA, §¹¦¨©¹«áªºOrder©O?

©±¦W¦C¦ì = Sheets("Total").Columns(aaa).Find(What:="A©±001", LookIn:=xlValues, Lookat:=xlWhole, SearchDirection:=xlPrevious).Row

Look at:=xlwhole
ªº¥Îªk¬O­n§¹¥þ¤ñ¹ï¡A§Ú¦³¤@¦æ¨Ã¨S¦³¥´¨ì
¦ý·Q¤F¤@¤U¥´¤F§¹¥þ¤ñ¹ï¦n¹³¤]¨S¥Î

¦]¬°§Ú·Q¨ì©pªº©±¦W¦³¥i¯à­«½Æ
¨º¤@¶}©lªº©w¦ì ©Î³\§A­n§ä¤@¤U¨ä¥L¤è¦¡
©ÎªÌ¥Îselection.rangeªº¤è¦¡
Àx¦s¦¨ÅܼơA¿ï¦n°_©lÄæ¦ì
¦b§ìÄæ¦C­È
¦A¶Çµ¹«á­±ªºµ{¦¡½X¨Ï¥Î

TOP

¦^´_ 2# boomf2
  1.     Sub ¦Û°Ê·s¼W¤é¤u§@ï§ó·s()

  2. ¥»ÀɦW = ActiveWorkbook.Name
  3. ¥»¸ô®| = ActiveWorkbook.Path


  4. '***********************************************§ä¥Xa©±001¦ì¸m***********************************
  5. For aaa = 1 To 20
  6. On Error Resume Next
  7. ©±¦WÄæ¦ì = Sheets("Total").Rows(aaa).Find(What:="A©±001", LookIn:=xlValues, SearchDirection:=xlPrevious).Column
  8. On Error GoTo 0
  9. Next

  10. For aaa = 1 To ©±¦WÄæ¦ì
  11. On Error Resume Next
  12. ©±¦W¦C¦ì = Sheets("Total").Columns(aaa).Find(What:="A©±001", LookIn:=xlValues, Lookat:=xlWhole, SearchDirection:=xlPrevious).Row
  13. On Error GoTo 0
  14. Next
  15. '***********************************************§ä¥Xa©±001¦ì¸m***********************************




  16. '***********************************************§ä¥X³Ì«á¤@¶¡©±¦ì¸m***********************************
  17. ©±¦W³Ì«áÄæ¦ì = Sheets("Total").Rows(©±¦W¦C¦ì).Find(What:="*", LookIn:=xlValues, Lookat:=xlWhole, SearchDirection:=xlPrevious).Column
  18. '***********************************************§ä¥X³Ì«á¤@¶¡©±¦ì¸m***********************************




  19. '***********************************************§ä¥X²£«~¼Æ¶q***********************************
  20. ²£«~codeÄæ = Sheets("Total").Rows(©±¦W¦C¦ì).Find(What:="²£«~CODE", LookIn:=xlValues, Lookat:=xlWhole, SearchDirection:=xlPrevious).Column

  21. ²£«~code¦C = Sheets("Total").Columns(²£«~codeÄæ).Find(What:="*", LookIn:=xlValues, SearchDirection:=xlPrevious).Row

  22. ²£«~Á`¼Æ = ²£«~code¦C - ©±¦W¦C¦ì
  23. '***********************************************§ä¥X²£«~¼Æ¶q***********************************


  24. '***********************************************Åý¤§«á°j°é¥Î***********************************
  25. ²£«~°_©l¦C©w¦ì = ©±¦W¦C¦ì + 1
  26. ²£«~µ²§ô¦C©w¦ì = ²£«~code¦C
  27. '***********************************************Åý¤§«á°j°é¥Î***********************************

  28. ''*************************¨ä¥L¸ê°T*************************
  29. ¤é´Á¼È¦s = Workbooks(¥»ÀɦW).Sheets("Total").[G1]

  30. ''*************************¨ä¥L¸ê°T*************************





  31. '*************************¬y¤ô¸¹°j°é°_©l­È*************************
  32. ¬y¤ô = 1
  33. '*************************¬y¤ô¸¹°j°é°_©l­È*************************

  34. While ©±¦WÄæ¦ì < ©±¦W³Ì«áÄæ¦ì + 1

  35. ©±¦W = Workbooks(¥»ÀɦW).Sheets("Total").Cells(©±¦W¦C¦ì, ©±¦WÄæ¦ì)


  36. ¥XÀɸ¹ = "order" & ¬y¤ô
  37. Set nX = Workbooks.Add


  38. Application.DisplayAlerts = False

  39. ActiveWorkbook.Sheets(3).Delete
  40. ActiveWorkbook.Sheets(2).Delete
  41. ActiveWorkbook.Sheets(1).Name = ©±¦W


  42. ²£«~¹Bºâ¦C = ²£«~°_©l¦C©w¦ì
  43. ²£«~°±ºâ¦C = ²£«~µ²§ô¦C©w¦ì

  44.     orderrow = 1
  45.     While ²£«~¹Bºâ¦C < ²£«~°±ºâ¦C + 1
  46.     If Workbooks(¥»ÀɦW).Sheets("Total").Cells(²£«~¹Bºâ¦C, ©±¦WÄæ¦ì) <> "" Then
  47.    
  48.             ActiveWorkbook.Sheets(1).Cells(orderrow, 1) = "DK"
  49.             ActiveWorkbook.Sheets(1).Cells(orderrow, 3) = ¤é´Á¼È¦s
  50.             ActiveWorkbook.Sheets(1).Cells(orderrow, 4) = "DN"
  51.             ActiveWorkbook.Sheets(1).Cells(orderrow, 5) = "B99"
  52.             ActiveWorkbook.Sheets(1).Cells(orderrow, 6) = "©±¦W"
  53.             ActiveWorkbook.Sheets(1).Cells(orderrow, 7) = Workbooks(¥»ÀɦW).Sheets("Total").Cells(²£«~¹Bºâ¦C, ²£«~codeÄæ).Value
  54.             ActiveWorkbook.Sheets(1).Cells(orderrow, 8) = Workbooks(¥»ÀɦW).Sheets("Total").Cells(²£«~¹Bºâ¦C, ²£«~codeÄæ + 3).Value
  55.             ActiveWorkbook.Sheets(1).Cells(orderrow, 9) = Workbooks(¥»ÀɦW).Sheets("Total").Cells(²£«~¹Bºâ¦C, ©±¦WÄæ¦ì)
  56.             orderrow = orderrow + 1
  57.     End If
  58.    
  59.    
  60.     ²£«~¹Bºâ¦C = ²£«~¹Bºâ¦C + 1
  61.     Wend

  62. nX.SaveAs ThisWorkbook.Path & "/" & ¥XÀɸ¹ & ©±¦W
  63. nX.Close

  64. ¬y¤ô = ¬y¤ô + 1
  65. ©±¦WÄæ¦ì = ©±¦WÄæ¦ì + 1
  66. Wend


  67. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# boomf2


    ­èµo²{§A¦³¨â­Ó A©±002 ½Ð°Ý·Q¦p¦ó°Ï§O

   ¦]¬°ÀɮצWºÙ¤£¯à¦³­«½Æ

TOP

§Ú°µªº «ö¶s1 «Ü²Â
¥u¯à¦¨¥\¦b·sªºSHEET²£¥Í¤F ¯S©wORDER 1 - Sheet (A©±001).

½Ð°Ý­n¦p¦ó²¤Æ/§ó§ïVBA ...
boomf2 µoªí©ó 2017-1-9 01:31



    Order§ó·s1.rar (30.99 KB)

­ì¨Ó§Ú©ñ¿ùªþ¥ó¤F...³o­Ó¤~¹ïªº

§Ú°µªº «ö¶s1
¥u¯à¦¨¥\¦b·sªºSHEET²£¥Í¤F ¯S©wORDER 1 - Sheet (A©±001).

½Ð°Ý­n¦p¦ó²¤Æ/§ó§ïVBA, §¹¦¨©¹«áªº15±i Order©O?
¨ä¹ê§Ú·Q§â¥þ³¡15­Ó³£©ñ¦b·sWORKBOOK, ¤À¦¨15±iSHEETªº.

½Ð°ª«ü¾É¤@¤U­n«ç»ò¼gvba...:'(

TOP

        ÀR«ä¦Û¦b : ÀR§¤±`®¦¤v¹L¡B¶¢½Í²ö½×¤H«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD