How to remove +44 from mobile phone VBA?

vbanewbie68

Board Regular
Joined
Oct 16, 2021
Messages
171
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi

How to remove +44 from mobile phone. Please see my screenshot

1637256150853.png


This is my vba:
Imprt.Cells(x, OptInSMS).Value = Imprt.Cells(x, OptInSMS).Value
Thanks in advance.
Regards
Rej
 

Attachments

  • 1637255846076.png
    1637255846076.png
    16.9 KB · Views: 5

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
How about:

VBA Code:
    Dim Cel As Range
'
    For Each Cel In Range("Z1:Z" & Range("Z" & Rows.Count).End(xlUp).Row)
        If Left(Cel.Value, 3) = "+44" Then Cel.Value = Right(Cel.Value, Len(Cel.Value) - 3)
    Next
 
Upvote 0
Hi JohnnyL

Thank you for this and your time on this matter. Please see below this is what I have on the macro. The question is that how you convert your lines convert into this lines please?

OptInSMSNumber = WorksheetFunction.Match("OptInSMSNumber", Import.Cells(1, 1).EntireRow, 0)

Import.Cells(x, OptInSMSNumber).Value =

Best regards

V
 
Upvote 0
Hi Sir

It works! I have managed to remove +44 which is great :) but zero is missing. I need to add '0' so what is the best way for adding zero at the front of the mobile number please? Please see my screenshot below.

'Mobile phone format +44
If Left(Cells(x, OptInSMSNumber).Value, 3) = "+44" Then

Cells(x, OptInSMSNumber).Value = Right(Cells(x, OptInSMSNumber).Value, Len(Cells(x, OptInSMSNumber).Value) - 3)

End If

1637422711594.png

Best regards
V
 

Attachments

  • 1637422139938.png
    1637422139938.png
    19.2 KB · Views: 3
Upvote 0
VBA Code:
Cells(x, OptInSMSNumber).Value = "0" & Right(Cells(x, OptInSMSNumber).Value, Len(Cells(x, OptInSMSNumber).Value) - 3)
 
Upvote 0
Solution
VBA Code:
Cells(x, OptInSMSNumber).Value = "0" & Right(Cells(x, OptInSMSNumber).Value, Len(Cells(x, OptInSMSNumber).Value) - 3)
Thank you so much sir! I am pleased to tell you that it is working with adding zero at the front of the mobile phone. Thanks again for your kind help on this matter which is greatly appreciated :)

Best regards

V
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,258
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top