K
Ken
I am using the following code to replace all letters from a worksheet
Sub deletetest()
Dim ws As Worksheet
Dim Rep As String
Set ws = ActiveSheet
For i = 65 To 90
Rep = Chr(i)
Debug.Print Rep
ws.Cells.Replace What:=Rep, Replacement:="", LookAt:=xlPart,
SearchOrder:=xlByColumns, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Next
End Sub
For some reason it won't replace the H's. My immediate window shows
that Rep was H when i was 52. If I change the code to manually make
Rep="H" it replaces the H's. If I run search and replace on the
worksheet for H it replaces the H's; it is just the H in the loop that
it seems to skip.
Can someone tell me what is happening?
Thanks
Ken
Sub deletetest()
Dim ws As Worksheet
Dim Rep As String
Set ws = ActiveSheet
For i = 65 To 90
Rep = Chr(i)
Debug.Print Rep
ws.Cells.Replace What:=Rep, Replacement:="", LookAt:=xlPart,
SearchOrder:=xlByColumns, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False
Next
End Sub
For some reason it won't replace the H's. My immediate window shows
that Rep was H when i was 52. If I change the code to manually make
Rep="H" it replaces the H's. If I run search and replace on the
worksheet for H it replaces the H's; it is just the H in the loop that
it seems to skip.
Can someone tell me what is happening?
Thanks
Ken