Is there an easy way to do this? (formatting numbers)

  • Thread starter Thread starter Blasting Cap
  • Start date Start date
B

Blasting Cap

I have a column of numbers (nearly 400 or more) in two separate
spreadsheets.

I need to copy this column of numbers into a SQL query, and to do that,
I will have to have it formatted like:

'12345',
'23456',

and so on.

It's currently:
12345
23456

Is there a way that I can format/edit each cell (other than manually) to
format it to bring it into SQL for a query?

Any help/ideas appreciated.

Thanks,

BC
 
Select your values and run:


Sub dont_quote_me()
Dim r As Range
For Each r In Selection
r.Value = Chr(34) & r.Value & Chr(34)
Next
End Sub
 
If you really need a single quote (apostrophe), then use CHAR(39) instead.

Note that the leading quote will be visible in the formula bar, not in the
cell.
 
Gary''s Student said:
If you really need a single quote (apostrophe), then use CHAR(39) instead.

Note that the leading quote will be visible in the formula bar, not in the
cell.


I did.

I got around it by putting in chr(39) & chr(39) - two single quotes - to
start the line.

Thanks for the help!!
 
You are very welcome!
--
Gary''s Student


Blasting Cap said:
I did.

I got around it by putting in chr(39) & chr(39) - two single quotes - to
start the line.

Thanks for the help!!
 

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

Back
Top