Godders199
Active Member
- Joined
- Mar 2, 2017
- Messages
- 313
- Office Version
- 2013
Good morning, i am trying to get the following code to work, have tried various combinations of if ,or, else, elseif but to no success.
I have not copied all the statements , but effectively what i am tying to do is. i column 6 (f)is between 1 an 8 it completes the relevant sum. If greater than 8 sum slighty different and if column 6 is zero it just returns zero. currently only the final line works. I cannot get if 1,2,3,4,5,6,7,8 to work.
If Cells(i, 6) = 1 Then Range("ab" & i).Value = Range("p" & i).Value + Range("s" & i).Value + Range("v" & i).Value + Range("y" & i).Value + Range("f" & i).Value
If Cells(i, 6) = 2 Then Range("ab" & i).Value = Range("p" & i).Value + Range("s" & i).Value + Range("v" & i).Value + Range("y" & i).Value + Range("f" & i).Value
If Cells(i, 6) > 8 Then Range("ab" & i).Value = Range("p" & i).Value + Range("s" & i).Value + Range("v" & i).Value + Range("y" & i).Value + Sheets("Homepage").Range("o4").Value Else Cells(i, 28).Value = 0
Can someone say what i am doing wrong.
thanks
I have not copied all the statements , but effectively what i am tying to do is. i column 6 (f)is between 1 an 8 it completes the relevant sum. If greater than 8 sum slighty different and if column 6 is zero it just returns zero. currently only the final line works. I cannot get if 1,2,3,4,5,6,7,8 to work.
If Cells(i, 6) = 1 Then Range("ab" & i).Value = Range("p" & i).Value + Range("s" & i).Value + Range("v" & i).Value + Range("y" & i).Value + Range("f" & i).Value
If Cells(i, 6) = 2 Then Range("ab" & i).Value = Range("p" & i).Value + Range("s" & i).Value + Range("v" & i).Value + Range("y" & i).Value + Range("f" & i).Value
If Cells(i, 6) > 8 Then Range("ab" & i).Value = Range("p" & i).Value + Range("s" & i).Value + Range("v" & i).Value + Range("y" & i).Value + Sheets("Homepage").Range("o4").Value Else Cells(i, 28).Value = 0
Can someone say what i am doing wrong.
thanks