Need VBA code for Searching a string of text in excel spreadsheet, applying formula, replacing

calman91

New Member
Joined
Mar 14, 2018
Messages
4
I have a spreadsheet with 500 entries of phone numbers on rows with spaces in the field:
exp
64 211 902 661 i need to search for alll numbers with this text string (of course it will be different numbers) ,
then apply formula =HYPERLINK("callto:+"& SUBSTITUTE(B2," ","")) of course not using b2 but search result , then i need to replace that cell with the value , or the hyperlink made
final result should look like this
callto:+64211902661

<tbody>
</tbody>

thank you

j

<tbody>
</tbody>
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
so you want to search all 500 rows for 64 211 902 611. When found you want to replace that value with a the value from the formula =hyperlink("callto:+"& x )?

x=the value found in the cell minus the spaces
x="callto:+" & x

correct?
 
Upvote 0
yes kinda , but im not searching for that number in particular, there will be many numbers all with a country code of 64
 
Upvote 0
so you want to search all 500 rows for 64 211 902 611. When found you want to replace that value with a the value from the formula =hyperlink("callto:+"& x )?

x=the value found in the cell minus the spaces
x="callto:+" & x

correct?

yes kinda , but im not searching for that number in particular, there will be many numbers all with a country code of 64
 
Upvote 0
cant you just write the formula in a different column and then paste (as values) that column over the original? I am not certain this is something that needs code to do. either it is one step to push a button or three steps to write formula, copy to end of data, copy & paste special values over destination.

wont save much time.

cell d2 = HYPERLINK("callto:+"& SUBSTITUTE(B2," ",""))

then copy all of column D and paste values over column B
 
Upvote 0
cant you just write the formula in a different column and then paste (as values) that column over the original? I am not certain this is something that needs code to do. either it is one step to push a button or three steps to write formula, copy to end of data, copy & paste special values over destination.

wont save much time.

cell d2 = HYPERLINK("callto:+"& SUBSTITUTE(B2," ",""))

then copy all of column D and paste values over column B

Well, all my records 500 unique records are not in columns but rows i cant transpose to a column . so unless im wrong i cant use the fill command this is what i have record one of 500

Audddddd
Michael xxxxxxx
JOB TITLE
E-MAIL
Chief Financial Officer at xyz company
info@xyz.com
CONTACT NUMBERS
MAILING ADDRESS
TELEPHONE61 xxxxxxxxxxxxADDRESSauzzie land
CELLPHONE 39 xyz Road
ALT PHONE CITYNSW xxxx eeeee 2222
FACSIMILE61 xxxvssss COUNTRYAustralia
Call Date :1st Email :Verify Date :Mail Out Date :
2nd Email :3rd Email :4th Email :
TQ Note
CLIENT ID FULL NAME
JOB TITLE
E-MAIL
CONTACT NUMBERS
TELEPHONE CELLPHONE ALT PHONE
FACSIMILE
MAILING ADDRESS
ADDRESS
CITY COUNTRY
Date 05-Mar-18


as you can see its all in rows not columns.

I would like to just make each unique record a hyperlink for the phone number, but utimitlay, i would love to just have the records like this:
Column Header .
Name, company name, job title, address, phone, alt phone, email address all of this in columns and then of course adding hyperlink to the phone number columns looking something like this in table form:

NameNumberDISPDate CalledEmail AddressCommentsEmail Sent
Andrew Jackson64xxxxxxxxxNA2/13/2018 2:59no answer 3



<colgroup><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>

<colgroup><col span="18"></colgroup><tbody>
</tbody>
but with the appropiate column headers with the addes info i need

thank you

J
 
Upvote 0
Ahh that changes things drastically.

Search the forum as there is a solution to taking all the text from a single cell and laying it out in columns. I know I saw it awhile back. If you can't find it then I would seek that solution first and this solution afterwards.
 
Upvote 0

Forum statistics

Threads
1,215,011
Messages
6,122,680
Members
449,091
Latest member
peppernaut

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