返回列表 上一主題 發帖

[發問] 請問關於跨工作表vlookup的vba語法

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim data As Range, Y As Variant
    Application.EnableEvents = False
    If Not Intersect(Target, [A1:A10]) Is Nothing Then
       ' Set data = ['sheet2'!$A$1:B$25]
        'Y = Application.VLookup(Target, data, 2, 0)
        Y = Application.VLookup(Target, ['sheet2'!$A$1:B$25], 2, 0)
        Target.Offset(, 1) = IIf(IsError(Y), "", Y)
     End If
    Application.EnableEvents = True
End Sub


大大想請問這一段是否有辦法把外框字體顏色也一併帶過來呢??? 感恩.......

TOP

        靜思自在 : 【蒙蔽的自由】人常在什麼都可以自由自在的時候,卻被這種隨心所欲的自由蒙蔽,虛擲時光而毫無覺知。
返回列表 上一主題