Remove preceding apostrophes.....

I receive many dumps from a Database that has every cell with a leading apostrophe. The attached sheet has a macro that when run will remove the apostrophe from cells that contain dates or numbers, but will not remove the preceding apostrophe from text. I hope to get the macro modified to remove all preceding apostrophes.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

prabhu rajendranCommented:
Try something like this.
Sub DeleteApostrophes()
Dim rCell As Range

For Each rCell In ActiveSheet.UsedRange
If rCell.PrefixCharacter = "'" Then
rCell.Value = rCell.Value
End If
Next rCell

End Sub

Open in new window

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Try this...
The following code will remove the apostrophe from both the text and numeric cells. You may need to format the number cells again once the apostrophe is removed from all the cells on the activesheet.

Sub RemoveApostrophe()
Dim cell As Range
Dim lc As Long
lc = Cells(1, Columns.Count).End(xlToLeft).Column + 1
Cells(1, lc).Copy
For Each cell In ActiveSheet.UsedRange
   cell.PasteSpecial xlPasteAll, operation:=xlAdd
Next cell
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Professor JMicrosoft Excel ExpertCommented:

in reality those are not apostrophies, although they look like apostrophies.

you can fix this without any macro select all of your data by Control + A and then  as shown in below screenshot click on clear formatting.

Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Well done Professor.
Sometimes Excel inbuilt features do wonders. Very clever one.
Professor JMicrosoft Excel ExpertCommented:
thanks Sktneer :-)
DougDodgeAuthor Commented:
This works perfectly, thank you.
Professor JMicrosoft Excel ExpertCommented:
 I am okay with that solution you selected as accepted , out of curiosity did that code really work? Becuase the file you uploaded had no apostrophes but it was just a format that needed clearance of format .
DougDodgeAuthor Commented:
Yes, the code really did work.
DougDodgeAuthor Commented:
As ProfessorJimJam pointed out, they really are not apostrophes, but they are there if you click in any given cell.
Professor JMicrosoft Excel ExpertCommented:
Thanks Doug for feedback
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
As the solution provided by Professor also works and simplest to adopt, please take a moment to use Request Attention to split the points. I will welcome if you do so.
Professor JMicrosoft Excel ExpertCommented:

Please :-) it is alright

No need to split points. Your solution works better for Doug , so that is what matters

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.