Half of the code works?

H

hotherps

This code moves the value Brk out of a series of 8 Cells with a value o
IND. If Brk Occurs in the first 3 cells it moves it to the front of th
8 cell group. If it occurs in the last three cells it should move it t
the end of the 8 cells but it does not.

Am I missing something?

I pasted it in to a clean worksheet within the range, and it still doe
not work all you need to do is type 8 cells with IND in them the
replace the first or second cell with Brk like this

IND IND Brk IND IND IND IND IND

When working the result is
Brk IND IND IND IND IND IND IND

But when it is like this
IND IND IND IND IND IND Brk IND
It does not do this:
IND IND IND IND IND IND IND Brk

Thanks

Dim i As Integer
Dim j As Integer
Dim startcolumn As Integer
Dim endcolumn As Integer
Dim startrow As Integer
Dim endrow As Integer
With Sheet236

startrow = 11
endrow = 298
startcolumn = 7 'Column D
endcolumn = 102 'Column CX

For i = startrow To endrow
For j = startcolumn To startcolumn + 3
If .Cells(i, j).Value = "Brk" Then
.Cells(i, j).Value = "IND"
.Cells(i, startcolumn).Value = "Brk"
End If
Next j
For j = endcolumn - 3 To endcolumn
If .Cells(i, j).Value = "Brk" Then
.Cells(i, j).Value = "IND"
.Cells(i, endcolumn).Value = "Brk"
End If
Next j
Next i

End Wit
 
H

hotherps

That does help, thanks.

I just tried it again and I still can't get it to work. It only work
if Brk appears in the first 4 cells (I increased it to 4) If it appear
in the last four cells it won't move it to the right?

Could you zip me back a copy of a workbook that you have it workin
in?

You can send it to (e-mail address removed)

and thanks agai
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top