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

[µo°Ý] ½Ð°Ý¦p¦ó§ó§ïµ{¦¡Åܦ¨¥i·s¼W¬ö¿ý

[µo°Ý] ½Ð°Ý¦p¦ó§ó§ïµ{¦¡Åܦ¨¥i·s¼W¬ö¿ý

½Ð°Ý¦U¦ì¤j¤j¤Î«e½ú­Ì

¥H¤Uµ{¦¡¸ÕµÛ¥ÎExcel VBA½s¼g«áµo²{¥u¯à·s¼W¦b¦P¤@¦C¬ö¿ý....½Ð°Ý¦p¦óÅܧó«á¥i¥HµL­­·s¼W¬ö¿ý!??

¦¹³¡¤À¬O¥Î¦b«ö¶sªº¥¨¶°¤º (¥Ø«e¥uª¾¹D¦ü¥G»P"   Set NewRecord = myTable.Rows(1).Offset(myTable.Rows.Count)   "¦³Ãö¦ý¤£ª¾¦p¦óÅܧó

½Ð¦U¦ì¤j¤j«e½ú­ÌÀ°¦£¬Ý¬Ý... ÁÂÁÂ!!

Sub ·s¼W¬ö¿ý()

    Dim formsheet As Worksheet, myTable As Range
    Dim NewRecord As Range, i As Long
    Dim addressList()
   
    Set formsheet = Sheets("¿é¤J¸ê®Æ")
     
    Set myTable = _
        ThisWorkbook.Names("¤u§@¥æ±µ¨Æ¶µ").RefersToRange
    '±N¿é¤J¥Î»PÂà¼g¥Ø¼Ð¦ì¸mªºªí®æ³]©wµ¹ÅܼÆ

    addressList = _
        Array("C4", "C5", "C6", "C7", "F5", "F6", "F7", "C8", "C9", "C10")
    '±N­nÂà¼gªºÀx¦s®æ½s¸¹Àx¦s¦b°}¦C¤º
        
    Set NewRecord = myTable.Rows(1).Offset(myTable.Rows.Count)      
    '¨ú±o¬ö¿ýªº·s¼W¦ì¸m
                  
    For i = 0 To UBound(addressList)
        NewRecord.Cells(1, i + 1).Value = _
            formsheet.Range(addressList(i)).Value
            
    Next
   
End Sub

RE: ½Ð°Ý¦p¦ó§ó§ïµ{¦¡Åܦ¨¥i·s¼W¬ö¿ý

ªþ¤W¸Ô²Óªþ¥ó«Ý½Ð¦U¦ì¤j¤jÀ°¦£½T»{¬O§_­þÃä½s¼g¦³»~¾É¦ÜµLªk·s¼W...ÁÂÁÂ!!
  1. Sub ·s¼W¬ö¿ý()

  2.     Dim formsheet As Worksheet, myTable As Range
  3.     Dim NewRecord As Range, i As Long
  4.     Dim addressList()
  5.    
  6.     Set formsheet = Sheets("¿é¤J¸ê®Æ")
  7.    
  8.     'Application.Goto _
  9.         'ThisWorkbook.Names("¤u§@¥æ±µ¨Æ¶µ").RefersToRange
  10.     '±q¦WºÙ¿ï¨ú¬¡­¶Ã¯µ¥¯ÅªºÀx¦s®æ½d³ò
  11.    
  12.     Set myTable = _
  13.         ThisWorkbook.Names("¤u§@¥æ±µ¨Æ¶µ").RefersToRange
  14.     '±N¿é¤J¥Î»PÂà¼g¥Ø¼Ð¦ì¸mªºªí®æ³]©wµ¹ÅܼÆ
  15.    
  16.     'Range("C4").Value = 1
  17.    
  18.     addressList = _
  19.         Array("C4", "C5", "C6", "C7", "F5", "F6", "F7", "C8", "C9", "C10")
  20.     '±N­nÂà¼gªºÀx¦s®æ½s¸¹Àx¦s¦b°}¦C¤º
  21.         
  22.     Set NewRecord = Worksheets("¤u§@¥æ±µ¨Æ¶µ").Range("B:D")
  23.     '¨ú±o¬ö¿ýªº·s¼W¦ì¸m
  24.                   
  25.     For i = 0 To UBound(addressList)
  26.         NewRecord.Cells(1, i + 1).Value = _
  27.             formsheet.Range(addressList(i)).Value
  28.             
  29.     Next
  30.    
  31. End Sub
½Æ»s¥N½X

´ú¸Õª©.zip (24.8 KB)

TOP

        ÀR«ä¦Û¦b : ¯à·F¤£·F¡A¤£¦p­W·F¹ê·F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD