Hi,
I have a below code i am trying to modify.
I have a value in cell P11. if the value in cell P11 starts with "L", I'd like to put "L13W and the last 8 digits of cell P11 in Q11. Can you please help
Modified to below code and its working now.
I have a below code i am trying to modify.
I have a value in cell P11. if the value in cell P11 starts with "L", I'd like to put "L13W and the last 8 digits of cell P11 in Q11. Can you please help
Code:
Sub RightFunction()
Dim c As Range
For Each c In ThisWorkbook.Sheets("Data").Range("P11")
If Left(c.Offset(0, 0), 1) = "" Then
c.Offset(0, 1).Value = "L13W " & Right(c.Offset(0, 0), 8)
ElseIf Left(c.Offset(0, -1), 1) = "B" Then
c.Value = "YTD"
End If
Next
End Sub
Modified to below code and its working now.
Code:
Sub RightFunction()
Dim c As Range
For Each c In ThisWorkbook.Sheets("Data").Range("P11")
If Left(c.Value, 1) = "L" Then
c.Offset(0, 1).Value = "L13W " & Right(c.Value, 8)
ElseIf Left(c.Offset(0, -1), 1) = "B" Then
c.Value = "YTD"
End If
Next
End Sub
Last edited: