I have this code, to replace specific text in all sheets in same column.
It should automatically count cells in first column and accordingly run While loop.
But code is not able to count number of cells everytime. in Other words variable count value is not changing
Dim count As Integer
For Each ws In Worksheets
count = ActiveSheet.range("A:A").Cells.SpecialCells(xlCellTypeConstants).count
i = 2
While i < count
Cells(i, Cells(Application.WorksheetFunction.Match("Tech", Rows(1), 0)).COlumn).Value = Replace(Cells(i, Cells(Application.WorksheetFunction.Match("Tech", Rows(1), 0)).COlumn).Value, "NNNN", "PP")
i = i + 1
Wend
Next ws
It should automatically count cells in first column and accordingly run While loop.
But code is not able to count number of cells everytime. in Other words variable count value is not changing
Dim count As Integer
For Each ws In Worksheets
count = ActiveSheet.range("A:A").Cells.SpecialCells(xlCellTypeConstants).count
i = 2
While i < count
Cells(i, Cells(Application.WorksheetFunction.Match("Tech", Rows(1), 0)).COlumn).Value = Replace(Cells(i, Cells(Application.WorksheetFunction.Match("Tech", Rows(1), 0)).COlumn).Value, "NNNN", "PP")
i = i + 1
Wend
Next ws