rdefino
asked on
Need to remove last 3 characters in each excel cell
I have a column that's has about 200 cells in it and I need to remove the last 3 characters from each cell.
i found this:
For Each cell In Selection
cell.Value = LEFT(cell,LEN(cell)-3)
Next cell
But I have no idea how to run it against the column.
any thoughts.
i found this:
For Each cell In Selection
cell.Value = LEFT(cell,LEN(cell)-3)
Next cell
But I have no idea how to run it against the column.
any thoughts.
In Excel - highlight a selection
1) go to the VBA IDE with Alt+F11
2) Create a module - Insert - Module
3) Create a Procedure - Insert - Procedure - "CutLast3Chars"
4) paste the code between Public sub ... and End Sub
5) while the cursor is also between the Pub sub and End sub, press F5
The module will be saved with this spreadsheet only
from then on - from the spread sheet - you can:
1) make a selection,
2) press Alt+F8
3) Click on CutLast3Chars and click on Run
Hope this helps.
1) go to the VBA IDE with Alt+F11
2) Create a module - Insert - Module
3) Create a Procedure - Insert - Procedure - "CutLast3Chars"
4) paste the code between Public sub ... and End Sub
5) while the cursor is also between the Pub sub and End sub, press F5
The module will be saved with this spreadsheet only
from then on - from the spread sheet - you can:
1) make a selection,
2) press Alt+F8
3) Click on CutLast3Chars and click on Run
Hope this helps.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Very easy, thanks!
Public Sub TrimCells()
Dim Cell As Range
For Each Cell In Selection
Cell.Value = LEFT(Cell,LEN(Cell)-3)
Next Cell
End Sub
Select the cells to edit and run the macro.
Kevin