Here is my code that I am working with. It is really simple, but still not working as expected.
Dim hey As Range
Set hey = Range("A1:A5")
For Each i In hey
If i.Value = "15" Then
i.Offset(0, 2).Value = "15" And i.Offset(0, 3).Value = "15"
ElseIf i.Value = 10 Then
i.Offset(0, 2).Value = "10" And i.Offset(0, 3).Value = "10"
ElseIf i.Value = 5 Then
i.Offset(0, 2).Value = "5" And i.Offset(0, 3).Value = "5"
ElseIf i.Value > 15 And i.Value = "*5" Then
i.Offset(0, 2).Value = "10" And i.Offset(0, 3).Value = "5"
Else: i.Offset(0, 2).Value = 10 And i.Offset(0, 3).Value = 10
End If
Next i
Right now, all it will do is offset by 2 columns and output 0. I cannot distinguish why and I am at the end of my mental rope with this. I'm sure it is something retardedly simple I am overlooking.
I've tried stepping through and it looks like it evaluates properly for each value in my sample, but still gives me the 0 value. Also, I was playing around with the quotations to see if that had to do with it, but they are strings I want to work with.
Thanks for any help.
Andstatements outside of the if statements. Break each piece into two lines.Select Caseinstead ofIf. Second you are mixing numeric values ant text value, are your cells filled with numbers or text? Could you give a sample of inputs? Third,i.Offset(0, 2).Value = "15" And i.Offset(0, 3).Value = "15"means put ini.Offset(0, 2).Valuethe result of ` "15" And i.Offset(0, 3).Value = "15"`, that is probably not what you try to do.15) or text-that-look-like-a-number (e.g."15"). They are not the same thing and boolean comparisons may not produce the correct results unless the proper comparison is made.