?
Solved

Excel VBA truncate cells in a column

Posted on 2014-04-07
2
Medium Priority
?
1,424 Views
Last Modified: 2014-04-09
Hi,

I need to truncate all the data in each cell in column I to just the first 20 characters (alpha & numeric) I was trying to use this but this example truncates the data in all columns. It doesn't look like it should, but it does.

Edit: I'm not trying to delete spaces, just make the max = the first 20 characters.

    Sheets("Sheet1").Select
    Columns("I:I").Select
    Dim rCell As Range
    For Each rCell In Range("I1", Cells(Rows.Count, 1).End(xlUp))
        rCell = Left(rCell, 20)
    Next rCell
0
Comment
Question by:swjtx99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

Accepted Solution

by:
Kimputer earned 2000 total points
ID: 39984757
Replace one line:

For Each rCell In ActiveSheet.UsedRange.Columns("I").Cells
0
 

Author Closing Comment

by:swjtx99
ID: 39988970
Works!

Thanks,

swjtx99
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
Viewers will learn the different options available in the Backstage view in Excel 2013.
Video by: Zack
Viewers will learn about various customizable options in Excel 2013.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question