Changing values in a row based on a cell in the row.

C

Casey

Hi,
I have a little matrix 5R x 6C. All cells within the matrix have data
validation in them to restrict the input to "1" or "0". It is OK to
have mutiple selections of "1's" in the same row, except if the user
happen to select a "1" for the sixth or last cell in the row. If that
happens I would like the other five cells in that row to have a value
of "0".
Something like

A B C D E F
1 1 0 0 1 1 0 ok
2 1 0 1 0 0 1 Not ok
3 0 0 0 0 0 1 ok
4
5
 
G

Guest

Once the user has enter the data, run this little macro

Sub fixit()
Dim i As Integer
For i = 1 To 5
If Cells(i, 6) = 1 Then
Cells(i, 1) = 0
Cells(i, 2) = 0
Cells(i, 3) = 0
Cells(i, 4) = 0
End If
Next
End Sub
 
C

Casey

Gary,
Thank you for your answer. I have been ill and couldn't reply to you.
haven't had a chance to try your code but it looks like what I need
Again thank you
 

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