Thread: only1
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default only1

Hi Kyoshirou,

The sub I attached does exactly what you need: if a value is entered in any
of cells C3,C4,C5, the other two will be automatically set to 0. Applying
Data validation to these cells will allow entering by typing only value 1 to
any of these cells.

Post if you need further assistance for installing the event sub!

Regards,
Stefi


€˛kyoshirou€¯ ezt Ć*rta:

Hi Stefi,

i trying to do this:
user can only enter one of the cells of C3,C4 or C5.
And the value can only be 1. Other 2 cell i have auto set to 0 value.
I mean user can enter:

c3: 1
c4: 0
c5: 0

or
c3: 0
c4: 0
c5: 1

or
c3: 0
c4: 1
c5: 0

"Stefi" wrote:

You have to use a Worksheet_Change event sub:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
Application.EnableEvents = False
Select Case Target.Row
Case 3
Range(Cells(4, Target.Column), Cells(5,
Target.Column)).Value = 0
Case 4
Cells(3, Target.Column).Value = 0
Cells(5, Target.Column).Value = 0
Case 5
Range(Cells(3, Target.Column), Cells(4,
Target.Column)).Value = 0

End Select
Application.EnableEvents = True
End If
End Sub


Apply Data validation on cells c3:c5 to limit the value to 1.

Regards,
Stefi

€˛kyoshirou€¯ ezt Ć*rta:

how to make user to fill in at most value of 1 inside
cell c3,c4,c5.
This means if c3 is inserted 1, c4 n c5 will auto set to 0.
Or if c4 is inserted 1, c3 n c5 will set to 0.
Or if c5 is inserted 1, c3 n c4 will set to 0.

thank