I have the following code which was working before but has stopped working since my upgrade to the Windows 2000 environment from NT 4.0:
Private Function Compare_Copy_Sheet(ws1 As Worksheet, ws2 As Worksheet) As String
With ws1
.Activate
.Unprotect
.Cells(R, 2).Replace _
what:=Stat_val, Replacement:=cstsStat_val, _
SearchOrder:=xlByColumns, MatchCase:=False
.Cells(R, 2).Interior.ColorIndex = 43
.Cells(R, 2).Borders.ColorIndex = 15
.Cells(R, 2).Font.ColorIndex = 1
End With
where Stat_Val is Value in Sheet1(ws1) and cstsStat_val is value in Sheet2(ws2)
The strange thing is that only the Replace function doesn't work and the lines after Replace work. There is no error generated.
Any ideas as to why?
TKS
Teks
Private Function Compare_Copy_Sheet(ws1 As Worksheet, ws2 As Worksheet) As String
With ws1
.Activate
.Unprotect
.Cells(R, 2).Replace _
what:=Stat_val, Replacement:=cstsStat_val, _
SearchOrder:=xlByColumns, MatchCase:=False
.Cells(R, 2).Interior.ColorIndex = 43
.Cells(R, 2).Borders.ColorIndex = 15
.Cells(R, 2).Font.ColorIndex = 1
End With
where Stat_Val is Value in Sheet1(ws1) and cstsStat_val is value in Sheet2(ws2)
The strange thing is that only the Replace function doesn't work and the lines after Replace work. There is no error generated.
Any ideas as to why?
TKS
Teks