G
Goobies
I have a loop in my code which compiles fine; however, it doesn't see
to be running (or doing anything?)
. The loop is supposed t
check the values of Column C in each row, If the value is different tha
the row below it, then it draws a line along the bottom of all thos
cells. The code is as follows with comments in blue:
For i = 2 To 1000 'run loop a maximum of 1000 iterations
j = i + 1 'j is 1 more than i so that j can be used t
check the next row
If ThisWorkbook.Worksheets("Sheet1").Cells(j, "C").Value <> "
Then 'check to see If Column C in the row after row(i) isn't empty, i
False then exit the loop
If ThisWorkbook.Worksheets("Sheet1").Cells(i, "C").Value <
ThisWorkbook.Worksheets("Sheet1").Cells(j, "C").Value Then 'check t
see if row(i) column C and row(j) column C have different values, i
true then row(i) needs to get formatted with a line along the bottom o
all row(i)'s cells
With Rows("i:i").Borders(xlEdgeBottom) 'Create a lin
along the bottom of all of row(i)'s cells
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End If
End If
Next
to be running (or doing anything?)
![Confused :confused: :confused:](/styles/default/custom/smilies/confused.gif)
check the values of Column C in each row, If the value is different tha
the row below it, then it draws a line along the bottom of all thos
cells. The code is as follows with comments in blue:
For i = 2 To 1000 'run loop a maximum of 1000 iterations
j = i + 1 'j is 1 more than i so that j can be used t
check the next row
If ThisWorkbook.Worksheets("Sheet1").Cells(j, "C").Value <> "
Then 'check to see If Column C in the row after row(i) isn't empty, i
False then exit the loop
If ThisWorkbook.Worksheets("Sheet1").Cells(i, "C").Value <
ThisWorkbook.Worksheets("Sheet1").Cells(j, "C").Value Then 'check t
see if row(i) column C and row(j) column C have different values, i
true then row(i) needs to get formatted with a line along the bottom o
all row(i)'s cells
With Rows("i:i").Borders(xlEdgeBottom) 'Create a lin
along the bottom of all of row(i)'s cells
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End If
End If
Next