Macro

S

shifty

Please help

is there a way to run a command of macro that will delete the 1st 17
characters of a cell that is selected?

Thanks
 
M

Mike H

Maybe

Sub marine()
If Len(ActiveCell.Value) > 16 Then
ActiveCell.Value = Mid(ActiveCell.Value, 18, Len(ActiveCell.Value) - 17)
End If
End Sub

Mike
 
D

Dave Peterson

If you have a column of this stuff, you could record a macro when you:

Select the range
Data|Text to columns
Fixed width
remove any lines that excel guessed, but add a line between character 17 and 18.

Choose to skip the first field

Choose general or text or whatever you want for the second field.
 
M

Mike H

try this

Sub marine()
For Each c In Selection
If Len(c.Value) > 16 Then
c.Value = Mid(c.Value, 18, Len(c.Value) - 17)
End If
Next
End Sub

Mike
 
Top