A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

adding apostrophe macro?



 
 
Thread Tools Display Modes
  #1  
Old April 24th, 2005, 04:06 PM
GolfGal
external usenet poster
 
Posts: n/a
Default 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

  #2  
Old April 24th, 2005, 04:21 PM
Paul B
external usenet poster
 
Posts: n/a
Default

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



  #3  
Old April 24th, 2005, 04:39 PM
GolfGal
external usenet poster
 
Posts: n/a
Default

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




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Formula revision? Mark Worksheet Functions 1 November 28th, 2004 01:43 AM
Macro for multiple charts JS Worksheet Functions 1 November 19th, 2004 03:44 AM
Save document without saving macro within it? Dave Peterson General Discussion 0 November 16th, 2004 11:42 PM
Macro buttons ...help please ttd Worksheet Functions 1 March 26th, 2004 08:47 PM


All times are GMT +1. The time now is 09:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.