开发者

Calling individual cell instead of range

The below macro is pulling a value from a cell which is referencing a range and then actioning accordingly. How can I change this to only run the case for the relevant entry in the cell?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Target.Address = "$C$5" Then
        Select Case Target.Value
        Case Phones4U, P4U
        Case MBNA, MBNA1
        'Case Is = O2, The_Problem_Network
        'Case Is = TMobile, TMobile
        'Case Is = 3, Run_3
        开发者_如何学编程'Case Is = Orange, Orange
        'Case Is = Carphone_Warehouse, CPW
        'Case Is = Virgin_Media, VirginMedia
        'Case Is = Virgin_Mobile, VirginMobile
        'Case Is = Lifestyle_Group, LSG
        'Case Is = BT, BT
        'Case Is = Barclays, Barclays
        'Case Is = Nat_West, NatWest
        'Case Is = RBS, RBS
        'Case Is = Unipart, Unipart
        'Case Is = Vodafone_Group, Vodafone
    End Select
    End If
End Sub

Thanks for your help.


I think that a syntax like this should work without problems

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$C$5" Then
        Select Case Target.Value
        Case "Phones4U"
                P4U
        Case "MBNA"
                MBNA1
        Case "O2"
                The_Problem_Network
       ' etc
    End Select
    End If

End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜