SAMCRO2014
Board Regular
- Joined
- Sep 3, 2015
- Messages
- 160
I am trying to create coding that will loop through column L (12) and if the cell contains the specific text or value then enter "Previous" or "Current" in adjacent cell in column M (13):
"Error" = Current
"[Rr]etro = Previous
> 201814 = Current
all other cells = Previous
Dim f As Long ' for fiscal
Dim Data As Worksheet
Set Data = ThisWorkbook.Sheets("Data")
Dim LastRowData As Long
LastRowData = Data.Cells(Rows.Count, 12).End(xlUp).Row
For f = 2 To LastRowData
If Cells(f, 12).Value Like "*[Rr]etro*" Then
Cells(f, 13) = "Previous"
If Cells(f, 12).Value Like "*Error*" Then
Cells(f, 13) = "Current"
ElseIf Cells(f, 12).Value > 201814 Then
Cells(f, 13) = "Current"
Else: Cells(f, 13) = "Previous"
End If
Next f
I think I may have too many arguments?
"Error" = Current
"[Rr]etro = Previous
> 201814 = Current
all other cells = Previous
Dim f As Long ' for fiscal
Dim Data As Worksheet
Set Data = ThisWorkbook.Sheets("Data")
Dim LastRowData As Long
LastRowData = Data.Cells(Rows.Count, 12).End(xlUp).Row
For f = 2 To LastRowData
If Cells(f, 12).Value Like "*[Rr]etro*" Then
Cells(f, 13) = "Previous"
If Cells(f, 12).Value Like "*Error*" Then
Cells(f, 13) = "Current"
ElseIf Cells(f, 12).Value > 201814 Then
Cells(f, 13) = "Current"
Else: Cells(f, 13) = "Previous"
End If
Next f
I think I may have too many arguments?