VBA find and replace ?

mikeprice53

Active Member
Joined
Jan 21, 2003
Messages
297
I am trying to find text using vba method and replace with nothing to wipe out the value.

there are other things already in the cell so thats why I need to find and relace but I need to do it with a button hence hte VBA way !

Please help

Thanks
 
Has anyone been able to do a find and replace for all foreign currencies? I need the currency symbol removed from cells as it causes the number to read as text. I have a current method that detects the currency symbol in an easy to locate cell, but am having trouble with the Thai Baht symbol (฿). VBA is reading it as character 63 or "?". When it does the replace, it replaces the entire contents of the cell. I put in a patch that if the currency symbol = chr(63) to replace the contents of the cell with .Value = Right(.Value, Len(.Value) - 1). This "works", but isn't ideal as some sheets have hundreds of rows and hundreds of columns.
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Has anyone been able to do a find and replace for all foreign currencies? I need the currency symbol removed from cells as it causes the number to read as text. I have a current method that detects the currency symbol in an easy to locate cell, but am having trouble with the Thai Baht symbol (฿). VBA is reading it as character 63 or "?". When it does the replace, it replaces the entire contents of the cell. I put in a patch that if the currency symbol = chr(63) to replace the contents of the cell with .Value = Right(.Value, Len(.Value) - 1). This "works", but isn't ideal as some sheets have hundreds of rows and hundreds of columns.
This formula will find the first digit in the cell and return it and everything after it as a Text value...

=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),99)

If the only thing in the cell is text (your currency symbol) followed by a number and you want that number to be a real number, add 0 to the above formula...

=0+MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),99)
 
Upvote 0
Alternatively as a test try
Code:
ActiveCell.Replace ChrW(3647), ""
 
Upvote 0
Thanks Rick, however I have a current working method that can remove the currency symbol cell by cell. I'm looking for more of a find and replace method that can do the entire sheet at once. Going cell by cell is very time consuming on larger documents.
 
Upvote 0
Thanks Fluff, that is exactly what I needed. It replace only the currency symbol the whole sheet at once.
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0
What I should have also said in post#16, but forgot!
My suggestion was a test to check if I had the correct symbol.
The search/replace remembers your previous settings so this would be a better way of doing it
Code:
ActiveCell.Replace ChrW(3647), "", xlPart, , , , False, False
 
Upvote 0

Forum statistics

Threads
1,215,332
Messages
6,124,313
Members
449,153
Latest member
JazzSingerNL

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