ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there an easy way to do this? (formatting numbers) (https://www.excelbanter.com/excel-programming/360690-there-easy-way-do-formatting-numbers.html)

Blasting Cap

Is there an easy way to do this? (formatting numbers)
 
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

Gary''s Student

Is there an easy way to do this? (formatting numbers)
 
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
--
Gary''s Student


"Blasting Cap" wrote:

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


Gary''s Student

Is there an easy way to do this? (formatting numbers)
 
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


"Blasting Cap" wrote:

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


Blasting Cap

Is there an easy way to do this? (formatting numbers)
 
Gary''s Student wrote:
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!!

Gary''s Student

Is there an easy way to do this? (formatting numbers)
 
You are very welcome!
--
Gary''s Student


"Blasting Cap" wrote:

Gary''s Student wrote:
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!!



All times are GMT +1. The time now is 04:29 PM.

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