Hi Mike,
If I know Dave, he'll reply with the fantastic piece of VBA that I can neither read nor understand.
In the meantime, how many records are we talking about? If it is just a couple hundred, I have two possible solutions.
However, if we're talking a major some major mainframe belch, then I'll have to defer to the master (Dave).
2500 lines approx tot 150kb
So, why don't you save the file as a tab-delimited
text file, and then take it into an editor and replace
tabs with |.
2.5gigawatts!! ("Back to the Future")
Mark's suggestion was one I was going to make.
The other is: concat the four fields into one with the pipe character. After writing the formula and copying it down 2500 lines, highlight the whole column of the formula, choose copy then choose Paste Special / Values.
Delete the orginal columns and save the new (single column data) as UNICODE text.
VBA would be quicker. I'm still studying that very hard.
Hi Mike
This is what I would do, now I'm sure there is a better way, and Dave won't like this because it has loops in it, but it's the only way I could think of.
After making your changes in Excel, Save the file as a Comma Separated file (.csv) and run this procedure.
Sub ChangeComma2Pipe()
Dim sData As String
Dim sOrgFile As String
Dim sDestFile As String
Dim iX As Integer
'Assign File Names
sOrgFile = Application.GetOpenFilename
sDestFile = Application.GetSaveAsFilename
'Open Files
Open sOrgFile For Input As #1 ' Open file for input.
Open sDestFile For Output As #2 ' Open file for output.
'Start
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, sData ' Reads each line into a var
For iX = 1 To Len(sData)
If Mid(sData, iX, 1) = "," Then
Mid(sData, iX, 1) = "|"
End If
Next iX
Print #2, sData ' Writes the current value of sData to a new file
sData = ""
Loop
Close #1 ' Close file.
Close #2 ' Close file.
End Sub
I hope this helps.
Jerid
Re: 2.5gigawatts!! ("Back to the Future")