View Single Post
  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

When you backspace 30 characters, are you wiping out all the "prefix" characters
in that cell or are you keeping some:

If you have this string:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX YZ
do you end up with:
abcdefghijklQRSTUVWXYZ (delete "middle" 30 characters)
or
QRSTUVWXYZ (keep only the last 10 characters)

If you delete the middle characters:

Option Explicit
Sub testme()
If Len(ActiveCell.Value) 40 Then
ActiveCell.Value = Left(ActiveCell.Value, Len(ActiveCell.Value) - 40) _
& Right(ActiveCell.Value, 10)
Else
ActiveCell.Value = Right(ActiveCell.Value, 10)
End If
ActiveCell.Offset(1, 0).Select
End Sub

If you're only keeping the final 10 characters:
Option Explicit
Sub testme2()
ActiveCell.Value = Right(ActiveCell.Value, 10)
ActiveCell.Offset(1, 0).Select
End Sub


mark h wrote:

I need to parse/edit one line at a time usng the same one-line macro. When I
use macro-recorder, it links to the specific cell reference. I need the
below macros to be free from specific cell references - it needs to run on
the current cell and move down one row.

{edit}{home}{Del 7}{d}
reads as: open cell in edit mode - move to the home position of the row -
delete seven characters - move down one line - end macro

and

{edit}{L 10}{BS 30}{D}
reads as: open cell in edit mode - move left 10 characters - backspace 30
characters - move down one line - end macro

Is there a simple macro that can do these?

thanx

Mark


--

Dave Peterson