我正在尝试为课程构建架构,但我明白了:
您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以便使用接近' NULL,Apartment INTEGER NULL,City'在第4行。
这是我的代码:
Sub Tester()
Dim c As Range, col As Collection, el
For Each c In Range("A1:A3")
Set col = FindAllMatches(Range("D1:D5"), c.Value)
For Each el In col
Debug.Print c.Address & " matched " & el.Address
Next el
Next c
End Sub
'Return a collection of all matches for 'txt' in Range 'rng'
' If no matches then the Count property of the returned collection
' will = zero
Function FindAllMatches(rng As Range, txt As String) As Collection
Dim rv As New Collection, f As Range, addr As String, txtSrch As String
Dim IsLong As Boolean
IsLong = Len(txt) > 250
txtSrch = IIf(IsLong, Left(txt, 250), txt)
'EDIT1: added the LookIn parameter setting...
Set f = rng.Find(what:=txtSrch, lookat:=xlPart, _
LookIn:=xlValues, MatchCase:=False)
Do While Not f Is Nothing
If f.Address(False, False) = addr Then Exit Do
If Len(addr) = 0 Then addr = f.Address(False, False)
If Not IsLong Then
rv.Add f 'always add
Else
'check for the *full* value
'EDIT2: make the Instr case-insensitive
If InStr(1, f.Value, txt, vbTextCompare) > 0 Then rv.Add f
End Id
Set f = rng.FindNext(after:=f)
Loop
Set FindAllMatches = rv
End Function
答案 0 :(得分:0)
我认为如果你解决了上述问题,那就没关系了。