Macro

  • Thread starter Thread starter shifty
  • Start date Start date
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
 
Maybe

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

Mike
 
Thanks
Can you apply this to a range of cells when selecte in a column?
 
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top