有一个表,有两列:
我需要用第二列字替换主表中的所有单词。
更改大表的所有值的最佳方法是什么?
Sub aizvietot_tulk()
Dim ws As Worksheet, tulkojumi As Worksheet
Set ws = ThisWorkbook.Worksheets("final_data")
Set tulkojumi = ThisWorkbook.Worksheets("Lapa1")
Set wsfin = ThisWorkbook.Worksheets("tulkojums")
RowCount = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
rowcountt = tulkojumi.Cells(tulkojumi.Rows.Count, "A").End(xlUp).Row
colcount = ws.UsedRange.Columns(ws.UsedRange.Columns.Count).Column
For i = 3 To RowCount
For j = 1 To colcount
vertiba = ws.Cells(i, j).Value
For k = 1 To rowcountt
mainamais = tulkojumi.Cells(k, 1).Value
jaunums = tulkojumi.Cells(k, 2).Value
nomainits = replace(vertiba, mainamais, jaunums)
wsfin.Cells(i, j) = Replace(vertiba, mainamais, jaunums)
Next k
Next j
Next i
End Sub
答案 0 :(得分:1)
这是我快速掀起的东西,我相信你可以适应它。你只需要一个循环。
body