View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Edit String VB Macro

Hi Lunch,

Try:

'=============
Public Sub Tester001()
Dim rng As Range
Dim rCell As Range

Set rng = Selection '<<==== CHANGE

For Each rCell In rng.Cells
With rCell
On Error Resume Next
If Not IsEmpty(.Value) Then
.Value = Mid(.Value, 5) & Left(.Value, 1)
End If
On Error GoTo 0
End With
Next rCell
End Sub
'<<=============


---
Regards,
Norman



"Lunch" wrote in message
oups.com...
I need to create a macro that will edit a simple string for me so I
don't have to do it by hand.

Qualifications

1) Need to be able to set the range (IE B1:H8) or whatever I need
2) The edit must read different lengths text (see examples)
3) Read and then place on letter at the end of the string.
4) Delete character and extra spaces.

Here is what the current format looks like.

T | TI06

Here is what I need to to look like

TI06T

Here is another example

N | KOS21 to KOS21N

In laymens terms it would be.

1) Read first character place at the end of the string.
2) Delete the first four characters/spaces of the string. (This is a
constant.)

Any help out there for me? Pretty please =)