Philip1957
Board Regular
- Joined
- Sep 30, 2014
- Messages
- 185
- Office Version
- 365
- Platform
- Windows
Greetings,
I have 3 and 4 character strings (column E) and I need to extract the second character from the right and place it in another cell (column O).
My code is giving me the last 2 characters. Is there a way to get just the second character or do I have to run a second macro to separate them?
I also need this to step & repeat through the selected range in column O but I haven't started that yet.
Thanks in advance for any assistance,
~ Phil
I have 3 and 4 character strings (column E) and I need to extract the second character from the right and place it in another cell (column O).
My code is giving me the last 2 characters. Is there a way to get just the second character or do I have to run a second macro to separate them?
I also need this to step & repeat through the selected range in column O but I haven't started that yet.
VBA Code:
Option Explicit
Sub ExtractLocCode()
Application.ScreenUpdating = False
Dim CodeString
CodeString = ActiveCell.Offset(0, -10).Value
Dim LocCode
LocCode = Right(CodeString, 2) ' Returns Loc code.
ActiveCell.Value = LocCode
Application.ScreenUpdating = True
End Sub 'ExtractLocCode
Thanks in advance for any assistance,
~ Phil