• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

I need a macro please!!!

Class00499

New Member
I need a macro that:

Will only work in Column H

I don't want the macro to delete data from another cell by accident.

Will delete the last letter in the cell(s) selected

leaving 10 characters in the cell

won't delete beyond the 10 characters

I don't want a button or anything like that associated with the macro

Just a simple CTRL+SHIFT+L or something like that.


I have found a couple that may work, but a flawless macro would be great!
 

Class00499

New Member
Sub Deletechars()

Set myRange = Selection

For Each myCell In myRange

myCell.Characters(11, 1).Delete

Next

End Sub


This is the latest macro that I found. Is there a way to make this macro work in a specific column and not the other columns?
 

Hui

Excel Ninja
Staff member
Class00499


Welcome to the Chandoo.org Forums


The following should be good for you

[pre]
Code:
Sub Deletechars()
Dim myCell As Range
For Each myCell In Selection
If myCell.Column = 8 And Len(myCell) > 10 Then myCell = Left(myCell, 10)
Next
End Sub
[/pre]
 
Top