View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Find and Replace

I have downloaded from the web the weather conditions. In cell ("a1"),
it
gives humidity: 70%. I would like with VBA remove "humitity:", leaving
just
the number "70%" and enter it in cell ("b1").


Something like this maybe...

With Range("A1")
If InStr(1, .Value, "humidity: ", vbTextCompare) 0 Then
.Offset(0, 1).Value = Mid$(.Value, InStr(.Value, " ") + 1)
End If
End With


By the way, worksheet formula would execute much faster than a macro. Here
is my contribution to the worksheet formula solution...

In B1: =--REPLACE(A1,1,10,"")

Rick