ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format sheet after importing a csv file (https://www.excelbanter.com/excel-programming/398466-format-sheet-after-importing-csv-file.html)

CSINVA

Format sheet after importing a csv file
 
I get data in the form of a csv file and I need to change one field
that that looks like this:

Col C (for example)

MORNING/EST
AFTERNOON/PACIFIC
WEEKEND/MST

I would like to break the cells into 2 different col one for time
(morning/afternoon, etc) and one for time zone (est, pacific, mst)

So I guess I need to count over to the / then take the timezone info
and pass it through a series of case statements, est = estern, mst =
mountain, and then put that into a new colunm.

I need to make this available whenever I open the file and not have to
recreate the code everything I get a new file.

Thanks for any help


joel

Format sheet after importing a csv file
 
Sub splitdate()

Columns("D:D").Insert

RowCount = 1
Do While Cells(RowCount, "C") < ""
slashpos = InStr(Cells(RowCount, "C"), "/")
If slashpos 0 Then
Cells(RowCount, "D") = _
Mid(Cells(RowCount, "C"), slashpos + 1)
Cells(RowCount, "C") = _
Left(Cells(RowCount, "C"), slashpos - 1)
End If
RowCount = RowCount + 1
Loop

End Sub



"CSINVA" wrote:

I get data in the form of a csv file and I need to change one field
that that looks like this:

Col C (for example)

MORNING/EST
AFTERNOON/PACIFIC
WEEKEND/MST

I would like to break the cells into 2 different col one for time
(morning/afternoon, etc) and one for time zone (est, pacific, mst)

So I guess I need to count over to the / then take the timezone info
and pass it through a series of case statements, est = estern, mst =
mountain, and then put that into a new colunm.

I need to make this available whenever I open the file and not have to
recreate the code everything I get a new file.

Thanks for any help




All times are GMT +1. The time now is 05:21 PM.

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