Solved

Excel VBA truncate cells in a column

Posted on 2014-04-07
2
1,178 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
2 Comments
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
A Short Story about the Best File Recovery Software – Acronis True Image 2017
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
Video by: Zack
Viewers will learn about various customizable options in Excel 2013.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now