VBA使用字符串和整数进行搜索

时间:2014-04-03 03:26:44

标签: excel vba excel-vba

好吧所以我正在寻找一种在Cells.Find代码中使用字符串的方法。代码将搜索我放入的文本而不是Job& "〜" &安培;起来但我需要它来寻找这个。感谢

Dim Job As String
Dim Up As Integer

Job = Range("C3").Value

For x = 0 To 10
Up = x + 1

'This is where I am having problems with searching for the String and Integer.

Cells.Find(What:= Job & "~" & up, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Next x

1 个答案:

答案 0 :(得分:2)

尝试添加额外代字号:

Cells.Find(What:= Job & "~~" & Up, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Excel uses tilde ~ as escape character