PC Review


Reply
Thread Tools Rate Thread

Allow value in only one of two cells

 
 
=?Utf-8?B?Q0xS?=
Guest
Posts: n/a
 
      24th Oct 2007
Hi All........

Having trouble here trying to build a toggle to allow an entry in only one
of two cells.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$K$10" Then
Range("k11").Value = ""
Range("K10").Value = "CRA"
Else
End If
If Target.Address = "$k$11" Then
Range("k10").Value = ""
Range("K11").Value = "CRA"
Else
End If
End Sub

The first IF works fine, the second one don't work at all.

Any help would be appreciated.

TIA
Vaya con Dios,
Chuck, CABGx3

 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      24th Oct 2007
If Target.Address = "$K$11" Then

the k must be uppercase
--
Gary''s Student - gsnu200751


"CLR" wrote:

> Hi All........
>
> Having trouble here trying to build a toggle to allow an entry in only one
> of two cells.
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
> If Target.Address = "$K$10" Then
> Range("k11").Value = ""
> Range("K10").Value = "CRA"
> Else
> End If
> If Target.Address = "$k$11" Then
> Range("k10").Value = ""
> Range("K11").Value = "CRA"
> Else
> End If
> End Sub
>
> The first IF works fine, the second one don't work at all.
>
> Any help would be appreciated.
>
> TIA
> Vaya con Dios,
> Chuck, CABGx3
>

 
Reply With Quote
 
=?Utf-8?B?Q0xS?=
Guest
Posts: n/a
 
      24th Oct 2007
" Oh for crying out loud!".............

Thank you kind Sir.........

Vaya con Dios,
Chuck, CABGx3



"Gary''s Student" wrote:

> If Target.Address = "$K$11" Then
>
> the k must be uppercase
> --
> Gary''s Student - gsnu200751
>
>
> "CLR" wrote:
>
> > Hi All........
> >
> > Having trouble here trying to build a toggle to allow an entry in only one
> > of two cells.
> >
> > Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
> > If Target.Address = "$K$10" Then
> > Range("k11").Value = ""
> > Range("K10").Value = "CRA"
> > Else
> > End If
> > If Target.Address = "$k$11" Then
> > Range("k10").Value = ""
> > Range("K11").Value = "CRA"
> > Else
> > End If
> > End Sub
> >
> > The first IF works fine, the second one don't work at all.
> >
> > Any help would be appreciated.
> >
> > TIA
> > Vaya con Dios,
> > Chuck, CABGx3
> >

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      24th Oct 2007
I like this style to avoid that problem:
If not (intersect(Target, me.range("k10")) is nothing) then



CLR wrote:
>
> Hi All........
>
> Having trouble here trying to build a toggle to allow an entry in only one
> of two cells.
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
> If Target.Address = "$K$10" Then
> Range("k11").Value = ""
> Range("K10").Value = "CRA"
> Else
> End If
> If Target.Address = "$k$11" Then
> Range("k10").Value = ""
> Range("K11").Value = "CRA"
> Else
> End If
> End Sub
>
> The first IF works fine, the second one don't work at all.
>
> Any help would be appreciated.
>
> TIA
> Vaya con Dios,
> Chuck, CABGx3


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
That document contains too many cells. At this time, spreadsheets inGoogle Docs only support up to 400000 cells Mark Microsoft Excel Misc 0 19th Jan 2011 03:08 PM
copy an intial cells contents into the next series of blank cells ina column freeriderxlt Microsoft Excel Discussion 2 25th Aug 2009 07:47 AM
Excel: match two cells in one sheet to two cells in another and return a third cells value Spence Microsoft Excel Worksheet Functions 2 19th Jul 2005 04:19 AM
Skip cells with TAB/SHIFT+TAB but allow arrow keys/mouse selection of skipped cells Wescotte Microsoft Excel Programming 1 6th Jun 2005 07:00 PM
A calculation to count all cells ='D' where the offset cells in range have dates <= todays date AlanN Microsoft Excel Misc 2 29th Jan 2004 03:57 PM


Features
 

Advertising
 

Newsgroups
 


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