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

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

¦^´_ 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

¦^´_ 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

¦^´_ 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

¦^´_ 2# lpk187


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

¾P³f.rar (42.51 KB)

TOP

¥»©«³Ì«á¥Ñ 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

        ÀR«ä¦Û¦b : ¤H¨ÆªºÁ}Ãø»PµZ¿i¡A´N¬O¤@ºØ¦ÒÅç¡C
ªð¦^¦Cªí ¤W¤@¥DÃD