Adding Quotation Marks to Data already in Mulitple Cells

R

Ron

How can I add quotation marks around content within multiple cells in an
excel spreadsheet without doing it manually in Office 2002? For example, If
there is data in Cells A1 through A100 and I want quotations marks around
the data in each cell is there a way to add the quotation marks in each cell
without losing the data? The data is both numeric and text.
 
G

Gary''s Student

Select the cells you want to modify and run:

Sub dont_quote_me()
q = Chr(34)
For Each r In Selection
r.Value = q & r.Value & q
Next
End Sub
 
R

Ron

Gary,
I take that this is a vbs script? If so then how do I get it to run in
the excel spreadsheet that I'm trying to add the quotation marks to?
 
G

Gary''s Student

Very easy:

1. touch ALT-F11 to bring up the VBE window
2. touch ALT-I
ALT-M to insert a fresh module
3. paste the stuff into the module
4. close the VBE window (save is not necessary)


to run the script

1. select the set of cells you want to process
2. touch ALT-F8
3. select the macro
4. touch run
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top