Removing a 'tab' from inside a cell's contents

tvoltagg

Board Regular
Joined
Mar 20, 2006
Messages
159
So I get some quirky data from a customer, where some of the fields look like this (brackets are MINE):

[RES]

and some look like this (brackets are MINE):

[R""ES ]

I figured I'd just replace out the double-quotes and spaces to get it to be consistent, but apparently there is a tab between the double quotes. If I manually go into one of the cells, put the curson after the 'R', and hit the delete key, the first quote goes away. If I hit the delete the key again, though, the spaces at the END go away. If I hit the delete key a third time, the 2nd quote goes away.

Does anyone know how to use the Ctrl-H feature to remove embedded tabs? I cannot use text-to-columns as not all of the rows have the same quirky stuff.

Thanks!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
You can input non-printing characters eg tabs into the Find What of the Edit/Replace dialog by using the character's relevant Unicode value and the numeric keypad. In find what, try holding down Alt and, using the numeric keypad, typing in 009.

EDIT: alternatively, the CLEAN function can be used to remove them too eg =CLEAN(A1)
 
Upvote 0
thanks so much for the quick response..

The CLEAN function works, but would be a bit bulky for what I'm trying to do.

When I hit ALT-009 in the find what box, nothing was entered. Any ideas why?
 
Upvote 0
Hmm, I must admit that I currently can't enter Ascii characters 1-31 from the numeric keypad (this is not a normal state of affairs, but all my attempts to rectify have come to naught) but you can get around it easily enough: when you have this sheet open on your screen, open up the VBE (Alt+F11) and then open up the Immediate Pane (Ctrl+G - should appear in the bottom right of the Visual Basic Editor). Paste the following in there and press return:

Code:
cells.Replace chr$(9),""
 
Upvote 0
Hmm.. that doesn't work either.

I'm using the replace function in my code, but it can't seem to locate the tabs. I suppose it's possible they aren't tabs..? I've copy/pasted one of the cells below..

"R"" ""ES" (pasted the cell)

R" "ES (pasted the cell from the formula bar)
 
Upvote 0
You can use the following code to identify what characters are making up your string:

Code:
Sub Give_Codes() 
    Dim b() As Byte, i As Long 
    If Selection.Count > 1 Then MsgBox "You must select a single cell": Exit Sub 
    b = StrConv(Selection.Value, vbFromUnicode) 
    With Worksheets.Add 
        .Cells(1, 1) = "Ascii Code": .Cells(1, 2) = "Character" 
        For i = 1 To UBound(b) + 1 Step 1 
            .Cells(i + 1, 1) = b(i - 1) 
            .Cells(i + 1, 2) = Chr$(b(i - 1)) 
        Next 
    End With 
End Sub

Select the cell containing the string and run the code - it'll dump the results into a new sheet.
 
Upvote 0

Forum statistics

Threads
1,214,539
Messages
6,120,100
Members
448,944
Latest member
SarahSomethingExcel100

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top