[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1560
  • Last Modified:

Excel VBA truncate cells in a column

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
swjtx99
Asked:
swjtx99
1 Solution
 
KimputerCommented:
Replace one line:

For Each rCell In ActiveSheet.UsedRange.Columns("I").Cells
0
 
swjtx99Author Commented:
Works!

Thanks,

swjtx99
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now