スプレッドシートの特定の 1 列幅の範囲で、Excel 2007 VBA のrange.findメソッドを使用して、2 文字の長さの値を含むテキスト値のセルを見つける必要があります: 8" (米国ではエイト インチと発音)。.findメソッドは次のとおりです。実行中の他のすべての検索で正常に機能するサブでは、8 "、または実際には末尾に二重引用符が付いたテキスト値を見つけることができないようです.
以下のコードでは、最初sComparisonTextに含まれています8"
sComparisonTextを使用して の末尾に 1 ~ 6 個の二重引用符を追加しようとしましChr(34)たが、.find メソッドはまだ Nothing を返します。
さまざまな検索でChr(34)アプローチが指摘されており、二重引用符を積み重ねています: """"resolves to "、""""""resolves to""など。特殊なエスケープ文字を持つメソッドも調べました.findが、そこでも成功しませんでした。
If Right(sComparisonText, 1) = """" Then
sComparisonText = sComparisonText & Chr(34) & Chr(34) & Chr(34) & Chr(34) & Chr(34) & Chr(34)
End If
Set rResult = rCT.Columns(InputColumn).Find(What:=sComparisonText, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If (rResult Is Nothing) Then 'Add a new row to the bottom of the rCT range
誰かが私が間違っていることを教えてもらえますか?
どうもありがとうございました!デイブ