View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Change the second to last from "0" to "-"

Sub replacezero()

MyStr = "abc000"
LastZero = InStrRev(MyStr, "0")
If LastZero 0 Then
If LastZero 1 Then
NextZero = InStrRev(MyStr, "0", LastZero - 1)
End If
If NextZero 0 Then
MyStr = Left(MyStr, NextZero - 1) & "-" & _
Mid(MyStr, NextZero + 1)
End If
End If

End Sub
"Steved" wrote:

Hello from Steved

Column B:B
numerals 6 to 8

Objective

Change the second to last from "0" to "-" please

I Thankyou.