ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   adding apostrophe macro? (https://www.excelbanter.com/excel-discussion-misc-queries/23385-adding-apostrophe-macro.html)

GolfGal

adding apostrophe macro?
 
I download a .csv sheet daily, open & save as excel, and link to access.
However, access returns some #Num errors. I need to convert several of the
columns to text, from what I read by adding apostrophe. Is there a macro
that I can run on certain columns that will add an apostrophe in front of
all? There are 7000 lines, so doing it manually is not possible.

Thanks


Paul B

Golf, here is one way

Sub add_apostrophe()
'will add an ' in front of whats in the used range in column A
Set rng = Intersect(Range("A:A"), ActiveSheet.UsedRange)
For Each c In rng
c.Value = "'" & c
Next
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"GolfGal" wrote in message
...
I download a .csv sheet daily, open & save as excel, and link to access.
However, access returns some #Num errors. I need to convert several of

the
columns to text, from what I read by adding apostrophe. Is there a macro
that I can run on certain columns that will add an apostrophe in front of
all? There are 7000 lines, so doing it manually is not possible.

Thanks




GolfGal

THANK YOU very much! That worked great!

"Paul B" wrote:

Golf, here is one way

Sub add_apostrophe()
'will add an ' in front of whats in the used range in column A
Set rng = Intersect(Range("A:A"), ActiveSheet.UsedRange)
For Each c In rng
c.Value = "'" & c
Next
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"GolfGal" wrote in message
...
I download a .csv sheet daily, open & save as excel, and link to access.
However, access returns some #Num errors. I need to convert several of

the
columns to text, from what I read by adding apostrophe. Is there a macro
that I can run on certain columns that will add an apostrophe in front of
all? There are 7000 lines, so doing it manually is not possible.

Thanks






All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com