PDA

View Full Version : Uppdate cellformat in cell



u25103
10-28-2008, 06:17 AM
Hi again

I've have an excelsheet that is imported from a text file.
Now I want to do a specific timeformat in column ("B:B"). (timeformat [t].mm).
But when i change the time format it dosen't change the format i the cell only then I dubbel click in the cell.

Is there som way to solve this with vba cod or a worksheet function?

: pray2:
thanks

RonMcK
10-28-2008, 06:46 AM
When you import the data this time field is formated as a text. You need to convince Excel to recalculate the field, converting it to a numeric so the time format will work.

You can do this by entering '1' (one) in a vacant cell outside your data, click on it and select edit-copy (or ^C), then, highlight all the values in column B, and click Edit-Paste Special (Alt-E-S), select the Multiply (Alt-M) option and click okay. Once you have done this, cick Format-Cells, and select your time format ([h]:mm or [hh]:mm), and click OK. Delete the "1" you entered, above, and proceed to format your other columns as needed.

How often do you need to import a file like this? If this is a one-off, then, the above process should work.

If, on the other hand, you do this regularly, we can create a program (macro) to do this for you but we'll need to know a wee bit more. Are you using Data > Text to columns? Are you using a delimited file? Delimiter is comma, pipe, or some other character?

Might you be able to post a sample import file with santized data (nothing confidential)? (Use Manage Attachments in the Additional Options section below the Edit Post section.)

Thanks,