Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default If Cell1 has something Cell2 is blank?

I have 6 Cells S,T,U,V,W & X and I only want to allow the user to put an "X"
in one of them in that row. How can I write a "IF" so that only one of the
6 cells contains a "X"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default If Cell1 has something Cell2 is blank?

Hi
if you have the cells A1:F1 try the following:
- select these cells
- goto 'Data - Validation - Custom'
- enter the following formula
=COUNTIF($A1:$E1,"X")<=1

--
Regards
Frank Kabel
Frankfurt, Germany

"HotRod" schrieb im Newsbeitrag
...
I have 6 Cells S,T,U,V,W & X and I only want to allow the user to put

an "X"
in one of them in that row. How can I write a "IF" so that only one

of the
6 cells contains a "X"



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default If Cell1 has something Cell2 is blank?

This generates an error if someone tries to enter text into another one of
the boxes but it doesn't really solve my problem. I'd prefer not to
interrupt the user.


"Frank Kabel" wrote in message
...
Hi
if you have the cells A1:F1 try the following:
- select these cells
- goto 'Data - Validation - Custom'
- enter the following formula
=COUNTIF($A1:$E1,"X")<=1

--
Regards
Frank Kabel
Frankfurt, Germany

"HotRod" schrieb im Newsbeitrag
...
I have 6 Cells S,T,U,V,W & X and I only want to allow the user to put

an "X"
in one of them in that row. How can I write a "IF" so that only one

of the
6 cells contains a "X"





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default If Cell1 has something Cell2 is blank?

Hi
but what should happen if the user tries to enter two 'X' values?

--
Regards
Frank Kabel
Frankfurt, Germany

"HotRod" schrieb im Newsbeitrag
...
This generates an error if someone tries to enter text into another

one of
the boxes but it doesn't really solve my problem. I'd prefer not to
interrupt the user.


"Frank Kabel" wrote in message
...
Hi
if you have the cells A1:F1 try the following:
- select these cells
- goto 'Data - Validation - Custom'
- enter the following formula
=COUNTIF($A1:$E1,"X")<=1

--
Regards
Frank Kabel
Frankfurt, Germany

"HotRod" schrieb im Newsbeitrag
...
I have 6 Cells S,T,U,V,W & X and I only want to allow the user to

put
an "X"
in one of them in that row. How can I write a "IF" so that only

one
of the
6 cells contains a "X"






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default If Cell1 has something Cell2 is blank?

Then the new "X" should stay and the other "X" should be removed. Like
"Radio Buttons" in VB.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Cell1 has something Cell2 is blank?

in that case you need a macro something like this

Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Row = 1) Then ' for row 1
If (Target.Column = 1 And Target.Column <= 6) Then ' fo
columns 1 to 6
If (Target.Value = "x") Then
For i = 1 To 6
If (i < Target.Column And ActiveSheet.Cells(1, i
= "x") Then
ActiveSheet.Cells(1, i) = ""
End If
Next i
End If
End If
End If
End Sub

note that I put a blank incase a new x is entered and there is alread
an x before

- Manges

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default If Cell1 has something Cell2 is blank?

How do I apply this to each row in the sheet, so that each row operates as
it's own group? Please don't tell me I need to re-write the code for each
row.

THANKS for the help



"mangesh_yadav " wrote in
message ...
in that case you need a macro something like this

Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Row = 1) Then ' for row 1
If (Target.Column = 1 And Target.Column <= 6) Then ' for
columns 1 to 6
If (Target.Value = "x") Then
For i = 1 To 6
If (i < Target.Column And ActiveSheet.Cells(1, i)
= "x") Then
ActiveSheet.Cells(1, i) = ""
End If
Next i
End If
End If
End If
End Sub

note that I put a blank incase a new x is entered and there is already
an x before

- Mangesh


---
Message posted from http://www.ExcelForum.com/



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Cell1 has something Cell2 is blank?

Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Column = 1 And Target.Column <= 6) Then ' fo
columns 1 to 6
If (Target.Value = "x") Then
For i = 1 To 6
If (i < Target.Column An
ActiveSheet.Cells(Target.Row, i) = "x") Then
ActiveSheet.Cells(Target.Row, i) = ""
End If
Next i
End If
End If
End Sub


- Manges

--
Message posted from http://www.ExcelForum.com

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default If Cell1 has something Cell2 is blank?

This worked great THANKS, not only that but I know have a really good idea
of what other stuff I can incorporate. THANKS


"mangesh_yadav " wrote in
message ...
Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Column = 1 And Target.Column <= 6) Then ' for
columns 1 to 6
If (Target.Value = "x") Then
For i = 1 To 6
If (i < Target.Column And
ActiveSheet.Cells(Target.Row, i) = "x") Then
ActiveSheet.Cells(Target.Row, i) = ""
End If
Next i
End If
End If
End Sub


- Mangesh


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to decrease cell1 value if i increase cell2 value & visaversa apmelectronic Excel Discussion (Misc queries) 6 June 25th 09 03:01 PM
Cell1 must be blank before cell2 can except date Daniel Excel Discussion (Misc queries) 1 May 11th 06 11:36 PM
Is there a function, if cell1=Text then cell2=#? Excel 03 A>B [email protected]> Excel Worksheet Functions 2 July 1st 05 07:24 PM
TEXT(Cell1,"MMMM YYYY") to work in all locale. Jonathan Rynd Excel Programming 0 February 12th 04 06:33 PM
TEXT(Cell1,"MMMM YYYY") to work in all locale. arno Excel Programming 0 February 10th 04 07:35 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"