Sub Maybe()
Dim c As Range
With Range("E1")
For Each c In Range("E2", .Offset(.CurrentRegion.Rows.Count - 1))
c.Value = Left(c.Value, Len(c.Value)-5)
Next c
End With
End Sub
Sub right5()
With Range([COLOR=#ff0000]"A1[/COLOR]", Range("[COLOR=#ff0000]A[/COLOR]" & Rows.Count).End(xlUp))
.Value = Evaluate("=IF({1},REPLACE(" & .Address & ",LEN(" & .Address & ")-4,5,""""))")
End With
End Sub
Sub right5()
With Range("A1", Range("A" & Rows.Count).End(xlUp))
.Value = Evaluate("=IF({1},MID(" & .Address & ",1,LEN(" & .Address & ")-5))")
End With
End Sub
Sub New_Patient()
With Sheet1.Range("c1", Sheet1.Range("c" & Rows.Count).End(xlUp))
.Value = Evaluate("=IF({1},REPLACE(" & .Address & ",LEN(" & .Address & ")-4,5,""""))")
End With
UserForm3.Show
End Sub
Sub New_Patient()
Dim rng as range
Dim sh as worksheet
Dim rCell as range
Set sh=worksheets(1)
Set rng=ws.Range("c1", ws.Range("c" & Rows.Count).End(xlUp))
For each rCell in rng
If rCell.Value<>"" then
rCell.value=left(cstr(rCell.value),len(cstr(rCell.value))-5)
End if
Next
Set rng = nothing
Set sh = nothing
UserForm3.Show
End Sub
Sub New_Patient()
[COLOR=#0000ff]Sheet1.select[/COLOR]
With Range("c1", Range("c" & Rows.Count).End(xlUp))
.Value = Evaluate("=IF({1},REPLACE(" & .Address & ",LEN(" & .Address & ")-4,5,""""))")
End With
UserForm3.Show
End Sub
Code:Sub right5() With Range("A1", Range("A" & Rows.Count).End(xlUp)) .Value = Evaluate("=IF({1},MID(" & .Address & ",1,LEN(" & .Address & ")-5))") End With End Sub
Sub test()
With Sheet1.Range("B1", Sheet1.Range("B" & Rows.Count).End(xlUp))
.Value = Evaluate("=mid(" & .Address & ",1,len(" & .Address & ")-5)")
End With
End Sub