Hi all,
i have tried to build a makro which replaces strings( sh.Cells(j, 4) -> list of 42 to words = find what ) in other strings ( sh.Range("A2", t) -> list of words where part f strings should be replaced ), with strings ( sh.Cells(j, 5) -> list of 42 words = replace with).
The issue i am having now is that when copying sh.Range("A2", t).Copy so a range in a column from the "A2" to the "last cell with value".
I would like to use the
sh.Range("A2", t).Copy
Destination:=sh.Range("B2")
instead of
sh.Range("A2", t).Copy
Range("B2").PasteSpecial
Application.CutCopyMode = False
But it is not working and saying " Compile Error _ expected expression "
Does somebody now what i do wrong and why it is not working?
Cheeers in advance .
Here is the code
Dim sh As Worksheet
Dim t As Range
Dim z As Range
Dim j As Integer
Set sh = Workbooks("pension_name_replacer.xlsm").Sheets("Input")
Set t = sh.Range("A" & Rows.Count).End(xlUp)
Set z = sh.Range("B" & Rows.Count).End(xlUp)
sh.Activate
sh.Range("A2", t).Copy
Range("B2").PasteSpecial
Application.CutCopyMode = False
For j = 2 To 43
sh.Range("B2", z).Replace sh.Cells(j, 4).Value, sh.Cells(j, 5).Value, xlPart, , False, , False, False
Next j
End Sub
Bookmarks