Scott Huish
MrExcel MVP
- Joined
- Mar 17, 2004
- Messages
- 20,330
- Office Version
- 365
- Platform
- Windows
I need to do the following in VBA as it is part of a bigger project.
I need to do a find and replace on , , and replace with ,
The problem is there could be multiple comma spaces, such as
, , ,
now that above Find and Replace would change that to , ,
If I was doing this manually I would repeat the Find and Replace until it didn't find anymore.
How can I do this in VBA?
So far this is what I have as a test for this:
It doesn't however generate an error when it doesn't find any, how can I repeat the code as long as it is necessary?
I need to do a find and replace on , , and replace with ,
The problem is there could be multiple comma spaces, such as
, , ,
now that above Find and Replace would change that to , ,
If I was doing this manually I would repeat the Find and Replace until it didn't find anymore.
How can I do this in VBA?
So far this is what I have as a test for this:
Code:
Sub test()
Cells.Replace ", ,", ", "
End Sub
It doesn't however generate an error when it doesn't find any, how can I repeat the code as long as it is necessary?