Try deleting the a, out of the brackest
Hi guys,
I'm trying to use a macro to search, find & replace some HTML throughout 500+ cells using the following code:
It gives me the compile error. What are the escape characters for VBA in this situation? Am I even going about this the right way?VB:Sub ReplaceText6() Dim a As Range For Each a In ActiveSheet.UsedRange a = Replace(a, "<table border="5"", "<table border="0"") Next End Sub
Thanks and kindest regards,
EC
Try deleting the a, out of the brackest
Hope that Helps
Roy
For free Excel tools & articles visit my web site
If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need
About me.
I don't think Excel likes the string you are looking for. Can't you edit the HTML in FrontPage?
You should use something like this, but the speech marks seem to confuse the Method
VB:Worksheets("Sheet1").Cells.Replace _ What:="<table border="5"", Replacement:=""<table border="0""", _ SearchOrder:=xlByColumns, MatchCase:=True
Hope that Helps
Roy
For free Excel tools & articles visit my web site
If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need
About me.
Hi, I've tried removing the a from the brackets, with no avail. I'm not quite sure how to use/implement the code in your second post though.
I could use an html editor, but theres 500+ cells that all contain the same code that needs to be replaced, so it would take a very long time and would be incredibly mundane. I know how to export the cell data (html) into individual .html files, so I could use an html editor that way, but then these files would have to somehow be imported back into the cells they originated form. I have no idea how to accomplish that...
Any other ideas/suggestions?
Hi,
You just need enough quotes in order for the parser to keep the ones you are interested inVB:Sub ReplaceText6() Dim a As Range For Each a In ActiveSheet.UsedRange a = Replace(a, "<table border=""5""", "<table border=""0""") Next End Sub
Cheers
Andy
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks