How do I delete part of a cell

R

Ron de Bruin

Hi Steve

Try this formula in the column next to it

=LEFT(A1,LEN(A1)-2)

With VBA you can do it in the same cell
If you want that post back
 
R

Ron de Bruin

Hi John

With your data in column A

Sub test2()
Dim cell As Range
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
If Len(cell) >= 2 Then
cell.Value = _
Left(cell, Len(cell) - 2)
End If
Next
End Sub
 
R

RagDyer

If all the strings are the same length, and you're always looking to
eliminate the last two characters, you can use,
<Data> <TextToColumns>,
<Fixed Width> <Next>,
Click to create a column break line to separate the last two characters,
Then <Finish>.
This moves the last two characters out of the original column into the next
adjoining column, where they can be deleted if necessary.
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================

For example,

1081004cw How can I get the last two characters
chopped off of that.
 
J

John

Thanks Ron


Ron de Bruin said:
Hi John

With your data in column A

Sub test2()
Dim cell As Range
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
If Len(cell) >= 2 Then
cell.Value = _
Left(cell, Len(cell) - 2)
End If
Next
End Sub
 
K

Ken Wright

This moves the last two characters out of the original column into the next
adjoining column, where they can be deleted if necessary.

Just select that column within the wizard and choose 'Do Not Import Column'
 
R

RagDyer

I do believe Ken, that doesn't eliminate the last two characters from the
original column, but *duplicates* the last two characters to an adjoining
column.
You *shouldn't* use "DoNotImport" if you want to remove the last two
characters.
--


Regards,

RD
--------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit!
-------------------------------------------------------------------

Ken Wright said:
This moves the last two characters out of the original column into the next
adjoining column, where they can be deleted if necessary.

Just select that column within the wizard and choose 'Do Not Import Column'
 
G

Gord Dibben

RD

Works for me.

Select the column with the last two letters and "Do not Import".

Gone!! One column of altered data remains.

Gord
 
R

RagDyer

OHhhh!
Is that what Ken meant!
*AFTER* the first go-round!

Thought he meant *during* the original division.

Pardon me Ken ... Sorry!

Thanks for the enlightenment Gord.
--


Regards,

RD
--------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit!
-------------------------------------------------------------------

"Gord Dibben" <gorddibbATshawDOTca> wrote in message
RD

Works for me.

Select the column with the last two letters and "Do not Import".

Gone!! One column of altered data remains.

Gord
 
G

Gord Dibben

RD

Ken and I do mean "during" the original division with Text to Columns
operation.

100234cw in cell.

Text to Columns>Fixed width>Next>Click a break line after 100234.

Next>Select cw column and "Do not import">Finish.

Gord
 
R

RagDyeR

Dummy, Dummy, Dumb Me!
--

Regards,

RD
--------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
--------------------------------------------------------------------

"Gord Dibben" <gorddibbATshawDOTca> wrote in message
RD

Ken and I do mean "during" the original division with Text to Columns
operation.

100234cw in cell.

Text to Columns>Fixed width>Next>Click a break line after 100234.

Next>Select cw column and "Do not import">Finish.

Gord
 

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