小编dhu*_*ton的帖子

InStr 或我的通配符是否会导致问题?

我不知道为什么这不起作用。它是一个更大的子例程的一部分,但我已将问题范围缩小到与 InStr 函数一起使用通配符。

我尝试尽可能多地查找有关 InStr 和通配符的信息,据我所知,这应该可行。但事实并非如此。

    Dim String1 As String
    Dim String2 As String
    Dim TestString As String
    Dim Location As Integer

    String1 = "Hello"
    String2 = "Goodbye"
    TestString = "Hello and Goodbye"
    Location = InStr(1, TestString, (String1 & "*" & String2), vbTextCompare)
    If Location >= 1 then
        'Do Something
    End If
Run Code Online (Sandbox Code Playgroud)

好吧,我已经根据人们的建议尝试了一些事情,现在我正处于这个阶段......

    Dim SourceString As String
    Dim TestString As String
    Dim TempArray() As String

    SourceString = "Hello and Goodbye"
    TestString = "hello * goodbye"

    TempArray = Split(TestString, …
Run Code Online (Sandbox Code Playgroud)

excel vba text-parsing

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

excel ×1

text-parsing ×1

vba ×1