Hi guys,
I am trying to run VBA macro to search the words "Red" or "Blue" in columns I, and if the condition is true it would need to process an RC[-9] formula in column N, accordingly.
However, I keep getting a 424 error per the red font below.
Any help would be great.
Sub test()
Sheets("Intern Confirmed Movement").Select
Dim Lastrow As Integer
Dim columnValues As Range, columnLookup As Range, i As Long
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Set columnValues = Range("N4:N" & Lastrow).Select
Set columnValues = Selection
Set columnLookup = Range("I4:I" & Lastrow).Select
Set columnLookup = Selection
For i = 1 To columnValues.Rows.Count
If columnLookup.Cells(i, 1).Value = "Red" Or columnLookup.Cells(i, 1).Value = "Blue" Then
columnValues.Cells(i, 1).Value = "=RC[-9]"
End If
Next
End Sub
I am trying to run VBA macro to search the words "Red" or "Blue" in columns I, and if the condition is true it would need to process an RC[-9] formula in column N, accordingly.
However, I keep getting a 424 error per the red font below.
Any help would be great.
Sub test()
Sheets("Intern Confirmed Movement").Select
Dim Lastrow As Integer
Dim columnValues As Range, columnLookup As Range, i As Long
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Set columnValues = Range("N4:N" & Lastrow).Select
Set columnValues = Selection
Set columnLookup = Range("I4:I" & Lastrow).Select
Set columnLookup = Selection
For i = 1 To columnValues.Rows.Count
If columnLookup.Cells(i, 1).Value = "Red" Or columnLookup.Cells(i, 1).Value = "Blue" Then
columnValues.Cells(i, 1).Value = "=RC[-9]"
End If
Next
End Sub