ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting Numbers Imports (https://www.excelbanter.com/excel-programming/413922-formatting-numbers-imports.html)

u473

Formatting Numbers Imports
 
I import a Cost Code which is structured as such : - ##-##-## (with an
existing unecessary leading hyphen but that is the way it is)

Unforturnately, MID(ActiveCell,4,8) for 09-04-50 returns a date
formatted as 9/4/1950 instead of the desired format as 09-04-50.
I tried to format the column as TEXT before the import, or MID with
TEXT() in my code without being able to fix the problem.
The solution is probably simple but I don't have it.
Help appreciated.
Celeste

Niek Otten

Formatting Numbers Imports
 
Rename the file to a .txt file before importing. This should start a wizard in which you can define the types of inputs.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"u473" wrote in message ...
|I import a Cost Code which is structured as such : - ##-##-## (with an
| existing unecessary leading hyphen but that is the way it is)
|
| Unforturnately, MID(ActiveCell,4,8) for 09-04-50 returns a date
| formatted as 9/4/1950 instead of the desired format as 09-04-50.
| I tried to format the column as TEXT before the import, or MID with
| TEXT() in my code without being able to fix the problem.
| The solution is probably simple but I don't have it.
| Help appreciated.
| Celeste



u473

Formatting Numbers Imports
 
Thank you for the advice but I wanted to do my import through VBA, not
through the import Wizard.
Celeste.


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

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