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

[µo°Ý] VBA°ÝÃD: ³]©w½d³ò­È¦P®ÉÅÜ°Ê®É,­n¦Û°Ê±a¥X¤½¦¡

¥»©«³Ì«á¥Ñ JasonChen576 ©ó 2018-1-29 13:13 ½s¿è

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim KeyCells As Range
        Set KeyCells = Range("A1:A5")
   
    Dim myShtName As String
        myShtName = KeyCells.Worksheet.Name

    Dim myRowsNum As Integer
        myRowsNum = Selection.Rows.Count
            
    Dim myShtµ²ªG As Worksheet
        Set myShtµ²ªG = Worksheets("µ²ªG")
   
    Dim myAddressOfTarget As String
   
    Dim i As Integer
   
    If Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then Exit Sub
   
    For i = 0 To myRowsNum - 1 - Target.Row
        myAddressOfTarget = Target.Resize(1).Offset(i, 0).Address(0, 0, xlA1, 1, 1)
        myShtµ²ªG.Cells(Target.Row + i, "B") = "=" & myAddressOfTarget & "*5"
    Next i
End Sub

TOP

        ÀR«ä¦Û¦b : ®É®É¦n¤ß´N¬O®É®É¦n¤é¡C
ªð¦^¦Cªí ¤W¤@¥DÃD