ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Changing values in a row based on a cell in the row. (https://www.excelbanter.com/excel-discussion-misc-queries/44694-changing-values-row-based-cell-row.html)

Casey

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

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


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=466377


Gary''s Student

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

--
Gary''s Student


"Casey" wrote:


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


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=466377



Casey


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


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=466377



All times are GMT +1. The time now is 12:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com