我有这段代码:
Sub PipelineStatusConvert()
Dim rng1 As Range
Dim tgt As Range
Dim ws As Worksheet
Dim cell As Object
Dim myarray As Variant
myarray = Array("1", "2", "3") '4, 5, 6, 7, 8, 9)
Set ws = ActiveWorkbook.ActiveSheet
Set rng1 = ws.Range("K13:K1000")
' If Intersect(ActiveCell, rng1) Is Nothing Then
'
' MsgBox "The active cell does NOT Intersect " & rng1.Address
'
' Else
'
' MsgBox "The active cell does Intersect " & rng1.Address
'
' End If
For Each cell In rng1
'evaluate something
If cell <> myarray Then
MsgBox "no intersection"
' MsgBox cell.Address
End If
' Select Case
' Case 1
Next cell
End Sub
我正在尝试检查所选范围内的每个单元格,并说如果单元格的值不在数组中(1-3),那么
'做点什么..
我一直遇到“类型不匹配错误”。我知道它与数组声明有关,因为我认为它正在尝试将单元格值与数组进行比较(这将不起作用)。
我将如何重新打理这个?
由于
答案 0 :(得分:0)
您需要编写一个函数来搜索数组中的值。稍微修改一下你的代码,我想出了以下内容:
print_r($_SERVER['HTTP_HOST']);