I'm looking for way around getting multiple values set to one variable declared as String. Following codes might give you a glimpse of what I'm looking for
我在寻找一种方法将多个值设置为一个声明为String的变量。下面的代码可能会让你对我正在寻找的东西略知一二
Dim Name as string
Name = value1 or value2 or value3
If range("A1"). Value = Name then
Activecell.entirecolumn.delete
End If
1 个解决方案
#1
1
Dim Name As String
Dim value1 As String, value2 As String, value3 As String
Name = value1 & "," & value2 & "," & value3
If InStr(Name, Range("A1")) <> 0 Then
ActiveCell.EntireColumn.Delete
End If
The program loop through A1 to see if one of the value match. If it does, Instr will return the position in Name where they match. So, simply tells your program that is Instr isn't equal to 0 to delete what you want
程序通过A1循环,看看其中一个值是否匹配。如果是,Instr将返回它们匹配的名称中的位置。因此,简单地告诉你的程序,Instr不等于0来删除你想要的。
#1
1
Dim Name As String
Dim value1 As String, value2 As String, value3 As String
Name = value1 & "," & value2 & "," & value3
If InStr(Name, Range("A1")) <> 0 Then
ActiveCell.EntireColumn.Delete
End If
The program loop through A1 to see if one of the value match. If it does, Instr will return the position in Name where they match. So, simply tells your program that is Instr isn't equal to 0 to delete what you want
程序通过A1循环,看看其中一个值是否匹配。如果是,Instr将返回它们匹配的名称中的位置。因此,简单地告诉你的程序,Instr不等于0来删除你想要的。