1
我的小問題波紋管:(替換字符與其他字符「鏈」
Option Compare Text
Sub pocetpismen()
With List1
Specialchar = "á.č.ř.ž.ý"
nonspec = "a.c.r.z.y"
delka = Len(Cells(8, 6))
delka1 = (delka - 1)/2
leva = Left(Cells(8, 6), delka1)
prava = Right(Cells(8, 6), delka1)
Cells(26, 4) = leva 'just to help me
For Each char In Split(Specialchar, ".")
leva = Replace(leva, char, Split(nonspec, "."))
Next
Cells(25, 4) = leva 'just to help me
If leva = prava Then
Cells(8, 6).Interior.Color = RGB(255, 204, 0)
ElseIf leva <> prava Then
Cells(8, 6).Interior.Color = RGB(255, 255, 255)
End If
End With
因此,在部分「鏈」:
For Each char In Split(Specialchar, ".")
leva = Replace(leva, char, Split(nonspec, "."))
Next
它不會爲了我想要替換的字符它(它甚至沒有運行)
我不希望,例如,將Specialchar = "á.č.ř.ž.ý"
中定義的所有字符替換爲單個字符,就像我會用
For Each char In Split(Specialchar, ".")
leva = Replace(leva, char, "X")
Next
我想á
被替換總是向a
,č
到c
等等... 任何幫助的傢伙? 提前致謝!
如果這適用於您,請接受綠色複選標記。 – Chrismas007