lehtojy1
lehtojy1

Reputation: 51

Excel VBA change value

I have Excel sheet where is phone numbers at international format (00358xxxxxxx)

and I need to replace that 00358 with 0

I manage to remove that 00358 but I lost leading 0 from phone number.

All cells are text-type

Worksheets("Sheet1").Range("A:B").Select Selection.NumberFormat = "@"

Dim sht As Worksheet
Dim fnd As Variant
Dim rplc As Variant

fnd = "00358"
rplc = "0"

For Each sht In ActiveWorkbook.Worksheets
sht.Cells.Replace what:=fnd, Replacement:=rplc, _
    LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
    SearchFormat:=False, ReplaceFormat:=False
Next sht

Upvotes: 1

Views: 51

Answers (1)

adhy wijaya
adhy wijaya

Reputation: 509

I think you can use:

rplc = "'0"

Good luck.

Upvotes: 0

Related Questions