Choosing the square character as a delimiter

G

Guest

Just wondering if anyone knows how to choose the square character as a
delimiter when importing a text file into Excel. I can't copy or paste it.

Thanks in advance.
 
D

Dave Peterson

Depends on what that is.

If it's alt-enter, you can hit and hold the alt key while typing 0010 on the
numeric keypad (or even just hit ctrl-j).

You can use Chip Pearson's Cell View addin to find out the character it is:
http://www.cpearson.com/excel/CellView.htm

Once you know what it is, you could try the alt-#### to see if it works.

If it doesn't, you could use a macro to change it to a different character (|
maybe???). Then use that character in the data|Text to columns. (Import to one
column, change the character, and then do data|Text to columns).

Option Explicit
Sub cleanEmUp()

Dim myBadChars As Variant
Dim myGoodChars As Variant
Dim iCtr As Long

myBadChars = Array(Chr(13))

myGoodChars = Array("|")

If UBound(myGoodChars) <> UBound(myBadChars) Then
MsgBox "Design error!"
Exit Sub
End If

For iCtr = LBound(myBadChars) To UBound(myBadChars)
ActiveSheet.Cells.Replace What:=myBadChars(iCtr), _
Replacement:=myGoodChars(iCtr), _
LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False
Next iCtr

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top