How do I manipulate characters within a cell?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hsemhsem9035
    New Member
    • Jul 2007
    • 1

    #1

    How do I manipulate characters within a cell?

    I've just about managed to get excel to delete a character/characters in the middle of a cell using visual basic using the following code:

    With Cells(1, 1)
    .Characters(3, 2).Delete
    End With

    But what I would like to do is do further manipulation, including:
    - Determining the length of a string and getting it into a variable
    - Deleting the last character in a string of unknown length
    - Putting new characters in to replace old characters at specific points

    Help much appreciated
  • fplesco
    New Member
    • Jul 2007
    • 82

    #2
    Originally posted by hsemhsem9035
    I've just about managed to get excel to delete a character/characters in the middle of a cell using visual basic using the following code:

    With Cells(1, 1)
    .Characters(3, 2).Delete
    End With

    But what I would like to do is do further manipulation, including:
    - Determining the length of a string and getting it into a variable
    - Deleting the last character in a string of unknown length
    - Putting new characters in to replace old characters at specific points

    Help much appreciated
    - Determining the length of a string and getting it into a variable
    dblCellLength = len(Cells(1, 1))

    - Deleting the last character in a string of unknown length
    Cells(1, 1) = mid(Cells(1, 1),1,len(cells( 1,1)) - 1)

    - Putting new characters in to replace old characters at specific points

    I'll get back to you on this.

    Comment

    Working...