I am trying to create a macro such that if a given cell in the range L2:L318 contains a particular value, the cell in column H in the same row is modified to a new string.
At this point, I have what appears to be something passable, but I get an 'Object Required' error when it runs. My code is as follows:
Sub Macro2()
Dim rng As Range
Dim cell As Range
Set rng = Worksheet.Range("L2:L318")
Dim i As Integer
For Each cell In rng
If cell.Value("902.4") Then
i = i + 1
Sheet.Cells(8, i).Value = "Text"
Else
i = i + 1
End If
Next cell
End Sub
I'll admit I haven't the slightest idea what I'm doing, and there's at least a moderate chance my code is complete nonsense. Can anyone explain to me what I'm doing wrong? Any help would be appreciated - I've literally never touched Excel macros before today!
Set rng =.Worksheetdefined? Is that supposed to beActiveSheet? Same withSheet. I'd suggest puttingOption Explicitat the top of the module and correcting all the errors it flags.