I'm tying to write an If statement within a Do loop stating:
If the value in column B is "X" and the max value of range B-M is < 5 Then...
But I can't seem to figure out how to tell it the range. The do loop ends at the end of the list
This part of the code doesn't work:
If Worksheets("Sheet1").Range(i - 3, 2) = "Fen" and Worksheets("Sheet1").Range(.cells(i - 3, 2), i - 3, 10)Then
'Set i to equal first row
i = 7
Do
'Pull values from another tab using formulas
.Cells(i + 1, 2).Formula = "= 'Pasted Feature Information'!A" & i - 4
.Cells(i + 1, 1).Formula = "= 'Pasted Feature Information'!B" & i - 4
If Worksheets("Sheet1").Range(i - 3, 2) = "Fen" And Worksheets("Sheet1").Range(.Cells(i - 3, 2), .Cells(i - 3, 10)) < 5 Then
.Cells(7, 5) = "Range"
.Cells(i + 1, 3).Formula = "=IFERROR(IF(AND(B" & i + 1 & "=""fen"", MAX('Results Drawdown'!C" & i - 2 & ":M" & i - 2 & ")> INDEX(Lists!$K$3:$M$7,MATCH(B" & i + 1 & ",Lists!$K$3:$K$7,0),2)),""send to Groundwater Specialist"",IF(AND(B" & i + 1 & "=""well"", MAX('Results Drawdown'!C" & i - 2 & ":M" & i - 2 & ")> INDEX(Lists!$K$3:$M$7,MATCH(B" & i + 1 & ",Lists!$K$3:$K$7,0),2)),""send to Groundwater Specialist"","""")),"""")"
.Cells(i + 1, 4).Formula = "=IF(AND(B" & i + 1 & "=""fen"",C" & i + 1 & "<>""""),""Drawdown was calculated at the fen"",IF(AND(B" & i + 1 & "=""well"",C" & i + 1 & "<>""""),""Drawdown in well may cause interference"",""""))"
End If
i = i + 1
Loop Until Cells(i, 1).Value = 0
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…