ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving the last character within the cell so it will be the first (https://www.excelbanter.com/excel-programming/409608-moving-last-character-within-cell-so-will-first.html)

ALEX

Moving the last character within the cell so it will be the first
 
Hi

I'm faily new using VB. I wanted to move the last character so it will be
the first character if only that character is a - . This will be withing the
whole workbook.

Gary''s Student

Moving the last character within the cell so it will be the first
 
Sub moveA()
For Each r In ActiveSheet.UsedRange
If IsEmpty(r.Value) Then
Else
v = r.Value
If Right(v, 1) = "a" Then
r.Value = "a" & Left(v, Len(v) - 1)
End If
End If
Next
End Sub
--
Gary''s Student - gsnu200780


All times are GMT +1. The time now is 05:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com