mrmmickle1
Well-known Member
- Joined
- May 11, 2012
- Messages
- 2,461
Right now I am cycling through each element in 2 arrays that are about 200 elements each. Is there a way where I can do this all in one action rather than the way I am currently doing it?
Any help would be much appreciated.
Code:
[COLOR=#0000ff]Sub[/COLOR] FindandReplace()
[COLOR=#0000ff] Dim[/COLOR] vFindText [COLOR=#0000ff] As Variant[/COLOR]
[COLOR=#0000ff] Dim[/COLOR] vReplaceText [COLOR=#0000ff]As Variant[/COLOR]
[COLOR=#0000ff] Dim[/COLOR] rowStart [COLOR=#0000ff] As Integer[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] rowEnd [COLOR=#0000ff] As Long[/COLOR]
[COLOR=#0000ff] Dim[/COLOR] ArrEle [COLOR=#0000ff] As Long[/COLOR]
[COLOR=#000000] rowStart = 2[/COLOR]
rowEnd = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
vFindText = Range(Cells(rowStart, 1), Cells(rowEnd, 1))
vReplaceText = Range(Cells(rowStart, 2), Cells(rowEnd, 2))
[COLOR=#0000ff]For[/COLOR] ArrEle = 1 [COLOR=#0000ff]To[/COLOR] rowEnd - 2
Columns("H:H").Replace What:=vFindText(ArrEle, 1), Replacement:=vReplaceText(ArrEle, 1)
[COLOR=#0000ff]Next[/COLOR] ArrEle
[COLOR=#0000ff]End Sub[/COLOR]
Any help would be much appreciated.