マクロVBAで新しく問題が発生しました。マクロVBA - 両方の文字列と似た番号の比較
私は比較する2つの文字列を持っていますが、どの文字列を両方の文字列に見つかった類似性の数字が表示されている結果として表示するのですか?
文字列1:1,2,3,4,6,7,8,9,10,11,12,13,19,20
文字列2:2,3,7,8,9 、10,11
比較後:
結果:2,3,7,8,9,10,11
コード:
If ActiveSheet.Cells(irow + 1, 12).Value = "" Then
'MsgBox "Data not found"
Else
temp = vbNullString
temp = ActiveSheet.Cells(irow + 1, 12).Value
'expanddata() use to expend a sequence of numbers into a display string as below
' 1,2-4,6 -> 1,2,3,4,6
temp = expanddata(temp)
If Worksheets("AI").Cells(irow + 1, 10).Value = temp Then
temp = ConvNum(temp) 'if whole string same then convert back to 1,2-4,6
Else
'the comparision make in here
End If
Worksheets("AI").Cells(irow + 1, 10) = temp
End If
はありがとうございます。
あなたは以上のループ、その後、二つの配列を作成するために、各文字列に 'スプリット(stringHereを、「」)'を使用することができます配列を比較し、内容を比較します。 –
Tim Williamsさん、ありがとう、私はすでに問題を解決しています。どうもありがとう。 :) – Empty
この場合、質問を削除するか、解答として回答を投稿すると便利です。 –