#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default simple edit

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default simple edit

One way:

Do Until IsEmpty(ActiveCell.Value)
With ActiveCell
.Value = Mid(.Text, 5)
.Offset(1, 0).Activate
End With
Loop

In article .com,
excelnut1954 wrote:

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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default simple edit

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

--
Gary''s Student - gsnu2007a


"excelnut1954" wrote:

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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default simple edit

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


"excelnut1954" wrote:

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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default simple edit

On Oct 30, 11:07 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
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



"excelnut1954" wrote:
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.- Hide quoted text -


- 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.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default simple edit

So you only want to keep the left 5 characters... try this

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

Jim Thomlinson


"excelnut1954" wrote:

On Oct 30, 11:07 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
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



"excelnut1954" wrote:
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.- Hide quoted text -


- 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
Why can't I edit my excel document? Edit buttons shaded. Arl @ CBC New Users to Excel 3 September 7th 05 01:18 AM
Need simple little macro - edit add 3 spaces John Grossman Excel Worksheet Functions 4 August 2nd 05 06:12 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM


All times are GMT +1. The time now is 02:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"