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

[µo°Ý] ½Ð°Ý«e½ú­Ì ¦p¦óÅýVBA ¨Ì¾ÚÄæ¦ì¸Ìªº¦WºÙ¥h·j¯Á¨ì¦P¦WºÙªº¤u§@ªí

[µo°Ý] ½Ð°Ý«e½ú­Ì ¦p¦óÅýVBA ¨Ì¾ÚÄæ¦ì¸Ìªº¦WºÙ¥h·j¯Á¨ì¦P¦WºÙªº¤u§@ªí

½Ð°Ý«e½ú­Ì ¦p¦óÅýVBA ¨Ì¾ÚÄæ¦ì¸Ìªº¦WºÙ¥h·j¯Á¨ì¦P¦WºÙªº¤u§@ªí
§Ú°µ¤F¤@­Ó¾P³f¨t²Î  ¦b"¾P³f³æ"¤u§@ªí¤W§¹¦¨¶ñ¼g«á «ö¤U«ü©wªº¥¨¶°
´N·|¦Û°Ê¾É¤J"¾P³f²M³æ"¤¤
°ÝÃD¨Ó¤F ¦]¬°«È¤á²£«~³£¤£¬Û¦P ©Ò¥H¶·­n§â¦U«È¤áªº¾P³f²M³æ¤À¶}
¨Ò¦p¤À¦¨¾P³f²M³æA¬°"A¤½¥q"¤u§@ªí¦WºÙ©M¾P³f²M³æB¬°"B¤½¥q"¤u§@ªí¦WºÙ
¦bA1Äæ¦ì ³]¸m¤F¸ê®ÆÅçÃÒªº²M³æ ¥i¨Ñ¿ï¾ÜA¤½¥q¡BB¤½¥q
¦p¦óÅýVBA ¨Ì¾ÚA1Äæ¦ìªº¦WºÙ ¥h·j´M¨ì©MA1Äæ¦ì¦P¦WºÙªº¤u§@ªí©O??
«ü¥O¸Ó¦p¼g©O??
«ô°U«e½ú­Ì«ü¾É«ü¾É§Ú «D±`·PÁÂ

¥»©«³Ì«á¥Ñ lpk187 ©ó 2015-10-2 23:30 ½s¿è

¦^´_ 1# ¶¶¶Õ¦Ó¬°

¥i¥Hªº¸Ü¡A³Ì¦n¤W¶ÇÀɤW¨Ó¡A¤ñ¸û¥i¥H±o¨ì¸û¥¿½Tªºµª®×
¤£µMªº¸Ü­è¤£¤[¦V­ã¤j¾Çªº»yªk¡A®M¶i¥h§Aªºµ{¦¡¤]¦æ
       SHN =Range("A1") 'Ū¨úA1Àx¦s®æªº­È¡A(A1Äæ¦ì¦P¦WºÙªº¤u§@ªí)
      On Error Resume Next'ªí¥Ü·í¤@­Ó°õ¦æ¶¥¬q¿ù»~²£¥Í®É¡Aµ{¦¡±±¨î¥ß¨è¨ìµo¥Í¿ù»~³¯­z¦¡±µ¤U¥hªº³¯­z¦¡
     Set xS = Sheets(SHN) '³]©w xS ¬°´M§äªº¤u§@ªí ¦pªG§ä¤£¨ì·|²£¥Í¿ù»~¡A©Ò¥H­n¦³¤W¤@¥y©M¤U¤@¥y
     On Error GoTo 0 '°±¤î²{¦bµ{§ÇùØ¥ô¦ó¤w±Ò°Êªº¿ù»~³B²zµ{¦¡
µM«á«á­±
With xS      'xS=Sheets("A¤½¥q")
      ...  
      ...
End With
¥H¤W¶È¨Ñ°Ñ¦Ò

TOP

¦^´_ 2# lpk187


    ÁÂÁ«e½úÄ@·N«ü¾É
¥H¶Ç¤Wªþ¥ó ¥u¬OA1Äæ¦ìÅܦ¨¦bO14  ¨Ï¥Îªº¥¨¶°¬O"¾É¤J"  «ô°U«e½úÀ°À°§Ú ªü¬°¥Ñ°J·PÁÂ

¾P³f.rar (42.51 KB)

TOP

¦^´_ 3# ¶¶¶Õ¦Ó¬°

¦Ò¼{§A¤£¯à¤U¸üÀɮסA©Ò¥H¥uPO¤Wµ{¦¡½X¡A½Ð¦Û¦æ´«´«¸m
­ì¨Óªºµ{¦¡¡A¤j³¡¥÷§R°£±¼¤F¡A¶â¡I¤Óªø¤F¡I°}¦C¦p¦¹¨Ï¥Î¡A·|²Ö¦º¤Hªº¡A©Ò¥H§Ú§â¥¦§ï±¼¤F
  1. Sub ¾É¤J()

  2. With Sheets("¾P³f³æ")
  3.     If .[B12] = "" Then MsgBox "½Ð¿é¤J¸ê®Æ«á¦A«ö«ö¶s ": Exit Sub
  4.     shN = .[O14]
  5.     Ro = .[B27].End(xlUp).Row
  6.     arr = .Range("C12:I" & Ro)
  7.     ¤é´Á = .[h7]
  8. End With
  9. On Error Resume Next 'ªí¥Ü·í¤@­Ó°õ¦æ¶¥¬q¿ù»~²£¥Í®É¡Aµ{¦¡±±¨î¥ß¨è¨ìµo¥Í¿ù»~³¯­z¦¡±µ¤U¥hªº³¯­z¦¡
  10. Set xS = Sheets(shN) '³]©w xS ¬°´M§äªº¤u§@ªí ¦pªG§ä¤£¨ì·|²£¥Í¿ù»~¡A©Ò¥H­n¦³¤W¤@¥y©M¤U¤@¥y
  11. On Error GoTo 0 '°±¤î²{¦bµ{§ÇùØ¥ô¦ó¤w±Ò°Êªº¿ù»~³B²zµ{¦¡
  12. With xS
  13.     xSro = .Cells(Rows.Count, 1).End(xlUp).Row + 1
  14.     .Cells(xSro, "B").Resize(UBound(arr, 1), UBound(arr, 2)) = arr
  15.     .Range("A" & xSro & ":A" & xSro + UBound(arr, 1) - 1) = ¤é´Á
  16. End With
  17. Sheets("¾P³f³æ").Select
  18. Range("B12:B26,D12:D26,H7:H8,H5").ClearContents
  19. Range("C4") = "S" & Format(Right(Range("C4"), 4) + 1, "0000")

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

TOP

¦^´_ 4# lpk187

«e½ú¯uªº¬O¤Ó·PÁ±z¤F ,¤@¦­¿ô¨Ó³£·P°Ê¨ì§Ö¬y²´²\¤F¡C
§Úª¾¹D§Ú¨º¼Ë¼g¬O²Â³Jªº¤è¦¡,©Ò¥H¤~¤£´±®³¤W¨Ó¶Ç¡C
§Ú¬O³o1~2­Ó¤ë¤~¦Û¤v±qºô¸ô¼v¤ù¾Ç²ßªº¶W¯Åªù¥~º~
¯uªº¬OÀ°¤F§Ú¦n¤jªº¦£ªü!!ÁÂÁÂ~¸U¤À·PÁ±z

TOP

¦^´_ 2# lpk187

'¡õ¥ÑÀx¦s®æ¨Ó«ü©w¤u§@ªí¡e¦WºÙ¡f
SHN =Range("A1")

'¡õ¡e©¿²¤¡fµ{¦¡¿ù»~¡A¡eÄ~Äò¡f©¹¤U°õ¦æ«á­±ªº«ü¥O
On Error Resume Next¡@
¡@
'¡õ³]©w xS µ¹¡e«ü©w¤u§@ªí¡f¡A¦pªG¸Ó¤u§@ªí¤£¦s¦b¡A·|²£¥Í¡e¿ù»~¨Ã¤¤Â_¡f¦b³o¤@¦æ¡A
Set xS = Sheets(SHN)¡@¡@'¦]¬°¦³¤W¤@¥y¡Aµ{¦¡¤£¤¤Â_¦Ó©¹¤U°õ¦æ

'¡õ¡e«ì´_¡fµ{¦¡¿ù»~³B²z¡A¥ç§Y On Error Resume Next ¨ì³o¦æ¥H«á´N¡e¥¢®Ä¡f¡A
'¡@¨ä«áµ{¦¡­Y¦³¿ù»~¡A¤@¼Ë·|²£¥Í¡e¤¤Â_¡f¡A¤£µM¤U¤èµ{¦¡¦³¿ù»~´NµLªkµo²{¡I
On Error GoTo 0

'¡õ©Ò¥H¡AÁÙ¬O­n¥[³o¦æ¥H¡e´£¿ô¡f¨Ï¥ÎªÌ¡A¨Ã¡e¸õÂ÷¡fµ{¦¡
If xS Is Nothing Then MsgBox "¤u§@ªí¤£¦s¦b": Exit Sub¡@¡@

'¡õ¤W¤è³£¨S°ÝÃD¡A¤~·|°õ¦æ¥H¤Uªºµ{¦¡½X¡A¥HÁקKµLªk¹wª¾ªº¿ù»~¡A³y¦¨¸ê®Æ¿ù»~
With xS      'xS=Sheets("A¤½¥q")
      ...  
End With

TOP

¦^´_ 6# ­ã´£³¡ªL

¹ï§q¡I§Ñ°O¥[¤F¡A·PÁ­ã¤j´£¿ô¡IÁÂÁÂ

TOP

¦^´_ 6# ­ã´£³¡ªL

­ã´£³¡ªLª©¤j: ÁÂÁ±zªºÄ_¶Q´£¿ô ,ªº½T¦³³o¤@ÂI¤p¤pªºª¬ªp ¡C
¦ý¬Oª©¤j If xS Is Nothing Then MsgBox "¤u§@ªí¤£¦s¦b": Exit Sub
³o¦æ¶K¤W¥h«á §Ú¥h°µ¤@­Ó¨S¦³¤u§@ªíªº°õ¦æ
«ü¥O¥u¶]¨ì   If xS Is Nothing Then ´N¥X²{°»¿ù¤F
¦Ó¤£·|Ä~Äò¶] MsgBox "¤u§@ªí¤£¦s¦b": Exit Sub ³o¬q¿ù»~´£¿ô
½Ð°Ý§Ú¬O­þ­Ó³¡¤À¿ù¤F??
  1. Sub ¾É¤J()
  2. Application.ScreenUpdating = False
  3. With Sheets("¾P³f³æ")

  4. If .[B12] = "" Then MsgBox "½Ð¿é¤J¸ê®Æ«á¦A«ö«ö¶s ": Exit Sub
  5.     shN = .[O14]
  6.     Ro = .[B27].End(xlUp).Row
  7.     arr = .Range("C12:I" & Ro)
  8.     ¤é´Á = .[h7]
  9. End With
  10. On Error Resume Next 'ªí¥Ü·í¤@­Ó°õ¦æ¶¥¬q¿ù»~²£¥Í®É¡Aµ{¦¡±±¨î¥ß¨è¨ìµo¥Í¿ù»~³¯­z¦¡±µ¤U¥hªº³¯­z¦¡
  11. Set xS = Sheets(shN) '³]©w xS ¬°´M§äªº¤u§@ªí ¦pªG§ä¤£¨ì·|²£¥Í¿ù»~¡A©Ò¥H­n¦³¤W¤@¥y©M¤U¤@¥y
  12. On Error GoTo 0 '°±¤î²{¦bµ{§ÇùØ¥ô¦ó¤w±Ò°Êªº¿ù»~³B²zµ{¦¡

  13. If xS Is Nothing Then MsgBox "¤u§@ªí¤£¦s¦b": Exit Sub

  14. With xS
  15.     xSro = .Cells(Rows.Count, 1).End(xlUp).Row + 1
  16.     .Cells(xSro, "B").Resize(UBound(arr, 1), UBound(arr, 2)) = arr
  17.     .Range("A" & xSro & ":A" & xSro + UBound(arr, 1) - 1) = ¤é´Á
  18. End With
  19. Sheets("¾P³f³æ").Select
  20. Range("B12:B26,D12:D26,H7:H8,H5").ClearContents
  21. Range("C4") = "S" & Format(Right(Range("C4"), 4) + 1, "0000")
  22. Range("O14").Select
  23. Application.ScreenUpdating = True
  24. End Sub
½Æ»s¥N½X

TOP

¦^´_ 7# lpk187

¯uªº«Ü·PÁ±z~

TOP

¦^´_ 8# ¶¶¶Õ¦Ó¬°

§A§âIf xS Is Nothing Then MsgBox "¤u§@ªí¤£¦s¦b": Exit Sub§â³o¦C©ñ¨ì
On Error GoTo 0 ¤W­±¬Ý¬Ý

TOP

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