simple edit

  • Thread starter Thread starter excelnut1954
  • Start date Start date
E

excelnut1954

I've done this before... but can't find the correct syntax...

In current cell. I want to
Edit, Home (to 1st character), delete first 4 characters, then down to
the next cell, then loop until there is an empty cell.
Thanks
j.o.
 
One way:

Do Until IsEmpty(ActiveCell.Value)
With ActiveCell
.Value = Mid(.Text, 5)
.Offset(1, 0).Activate
End With
Loop
 
Sub clipum()
Set r = ActiveCell
For i = 1 To 65536
r.Value = Right(r.Value, Len(r.Value) - 4)
Set r = r.Offset(1, 0)
If r.Value = "" Then Exit Sub
Next
End Sub
 
Something like this should be close (untested)...

dim rng as range

set rng = Range("A1")
do while rng.value <> ""
rng.value = mid(rng.value, 5, 256)
loop
 
Something like this should be close (untested)...

dim rng as range

set rng = Range("A1")
do while rng.value <> ""
rng.value = mid(rng.value, 5, 256)
loop

--
HTH...

Jim Thomlinson






- Show quoted text -

Thanks to all who responded.
Jim, so I can save examples for later reference, can you please
rewrite the rng.value line so that all is deleted from the cell EXCEPT
the 1st 5 characters.

rng.value = mid(rng.value, 5, 256)
This way, I'll better understand the syntax.
Thanks again
j.o.
 
So you only want to keep the left 5 characters... try this

rng.value = left(rng.value, 5)
 

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