Hi, I am trying to restart my loop counter(iColumn). I am looping through the columns to replace multiple words in a template(TemplateSheet). Is it possible to restart the loop counter after looping through all the columns(inside loop).
My only problem is after incrementing the row value, it goes back to the loop(columns) then the value of iColumn becomes 4 and terminates the inside loop.
While Sheets("DataSheet").Cells(iRow, 1).Value <> ""
While Sheets("DataSheet").Cells(1, iColumn) <> ""
sFind = Sheets("DataSheet").Cells(1, iColumn)
sReplacement = Sheets("DataSheet").Cells(iRow, iColumn)
sTemplate = Replace(sTemplate, sFind, sReplacement)
iColumn = iColumn + 1
Wend
Sheets("OutputSheet").Cells(iRow, 1) = sTemplate
iRow = iRow + 1
Wend
The problem was solved in restarting the loop counter. But now I have to overwrite the replacement function because it doesn't store the new replaced data.
iColumn = 1afteriRow = iRow + 1? Also, should the definition ofsFindnot go right before entering the inner loop?