以下宏从引用范围的单元格中提取值,然后相应地进行操作。如何将其更改为仅运行单元格中相关条目的大小写?
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
感谢您的帮助。
答案 0 :(得分:3)
我认为像这样的语法应该没有问题
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