Find and Replace

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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").
 
Format the cell for percentage. then use this formula

=VALUE(MID(A1,FIND(":",A1)+1,LEN(A1)))
 
Maybe something like this:

In VBA, you could use this:
Range(ActiveCell.Address).Offset(0, 1).Value = Right(ActiveCell.Value,
Len(ActiveCell) - 10)

As a formula, you could use this:
In B1, enter:
=RIGHT(A1,LEN(A1)-10)


HTH,
Paul
 
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

Rick
 
I have downloaded from the web the weather conditions. In cell ("a1"),
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top