ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find and Replace (https://www.excelbanter.com/excel-programming/391531-find-replace.html)

Daviv

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").
--
Thanks!

joel

Find and Replace
 
Format the cell for percentage. then use this formula

=VALUE(MID(A1,FIND(":",A1)+1,LEN(A1)))

"Daviv" wrote:

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").
--
Thanks!


PCLIVE

Find and Replace
 
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


"Daviv" wrote in message
...
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").
--
Thanks!




Rick Rothstein \(MVP - VB\)

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

Rick


Rick Rothstein \(MVP - VB\)

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



All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com