I am new to VBA (as in I started today) but have some experience with Matlab. I used excel formulas to create a box that when a length, height, and depth are imputed, ranges are created for each by adding plus and minus .25, or whatever you want. I have a table below it also with a column for lengths, widths and heights. I am trying to make it so the values in these rows will height up when all 3 (length, width, and height) fall into the ranges created described earlier. I really have been struggling but I will post my butchered code anyways. Also, how do I enter down a line in the If statement without an error? Using an underscore didn't seem to work for some reason.
Code:
Private Sub CommandButton2_Click()
Dim i As Long
For i = 10 To 50
If Range("a.i").Value >= Range("H4").Value And Range("a.i").Value <= Range("H4").Value And Range("b.i").Value >= Range("J4").Value And Range("b.i").Value <= Range("K4").Value And Range("c.i").Value >= Range("L4").Value And Range("c.i").Value <= Range("M4").Value Then cell.EntireRow.Interior.ColorIndex = 7
Next i
End Sub
[code]
Thank you greatly