Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default On click question?

Is there a way to add an x in a when you click in a cell in a range like
B3:G99 only and not the whole sheet? Right now I can do it to the whole sheet
with
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveCell.Value = "x"
End Sub
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default On click question?


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
Target.Value = "x"
End if
End Sub


if you want to toggle the x

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
if isempty(Target.Value) then
Target.Value = "x"
else
Target.clearContents
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
Is there a way to add an x in a when you click in a cell in a range like
B3:G99 only and not the whole sheet? Right now I can do it to the whole

sheet
with
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveCell.Value = "x"
End Sub
Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default On click question?

I get a syntax error on the intersect. Any idea why?

"Tom Ogilvy" wrote:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
Target.Value = "x"
End if
End Sub


if you want to toggle the x

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
if isempty(Target.Value) then
Target.Value = "x"
else
Target.clearContents
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
Is there a way to add an x in a when you click in a cell in a range like
B3:G99 only and not the whole sheet? Right now I can do it to the whole

sheet
with
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveCell.Value = "x"
End Sub
Thanks!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default On click question?

See fixed typo:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99")) is nothing then
Target.Value = "x"
End if
End Sub


if you want to toggle the x

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99")) is nothing then
if isempty(Target.Value) then
Target.Value = "x"
else
Target.clearContents
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
I get a syntax error on the intersect. Any idea why?

"Tom Ogilvy" wrote:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
Target.Value = "x"
End if
End Sub


if you want to toggle the x

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
if isempty(Target.Value) then
Target.Value = "x"
else
Target.clearContents
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
Is there a way to add an x in a when you click in a cell in a range

like
B3:G99 only and not the whole sheet? Right now I can do it to the

whole
sheet
with
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveCell.Value = "x"
End Sub
Thanks!






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default On click question?

I found it. Thank you for your help! Jeff

"Tom Ogilvy" wrote:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
Target.Value = "x"
End if
End Sub


if you want to toggle the x

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
if isempty(Target.Value) then
Target.Value = "x"
else
Target.clearContents
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
Is there a way to add an x in a when you click in a cell in a range like
B3:G99 only and not the whole sheet? Right now I can do it to the whole

sheet
with
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveCell.Value = "x"
End Sub
Thanks!






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default On click question?

Mr. Ogilvy,
A different Jeff here. I have been unable to get this to work on a cell
that has been merged. Would you please test that and see if that is the
case? If so, is there a fix? Thanks! -JEFF-

"Tom Ogilvy" wrote:

See fixed typo:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99")) is nothing then
Target.Value = "x"
End if
End Sub


if you want to toggle the x

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99")) is nothing then
if isempty(Target.Value) then
Target.Value = "x"
else
Target.clearContents
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
I get a syntax error on the intersect. Any idea why?

"Tom Ogilvy" wrote:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
Target.Value = "x"
End if
End Sub


if you want to toggle the x

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
if isempty(Target.Value) then
Target.Value = "x"
else
Target.clearContents
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
Is there a way to add an x in a when you click in a cell in a range

like
B3:G99 only and not the whole sheet? Right now I can do it to the

whole
sheet
with
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveCell.Value = "x"
End Sub
Thanks!






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default On click question?

In general,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 And Not Target.MergeCells Then Exit Sub
If Not Intersect(Target, Range("B3:G99")) Is Nothing Then
Target(1).Value = "x"
End If
End Sub

--
Regards,
Tom Ogilvy

"-JEFF-" wrote in message
...
Mr. Ogilvy,
A different Jeff here. I have been unable to get this to work on a cell
that has been merged. Would you please test that and see if that is the
case? If so, is there a fix? Thanks! -JEFF-

"Tom Ogilvy" wrote:

See fixed typo:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99")) is nothing then
Target.Value = "x"
End if
End Sub


if you want to toggle the x

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99")) is nothing then
if isempty(Target.Value) then
Target.Value = "x"
else
Target.clearContents
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
I get a syntax error on the intersect. Any idea why?

"Tom Ogilvy" wrote:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
Target.Value = "x"
End if
End Sub


if you want to toggle the x

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
if Target.count 1 then exit sub
if not Intersect(target,Range("B3:G99") is nothing then
if isempty(Target.Value) then
Target.Value = "x"
else
Target.clearContents
End if
End if
End Sub

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
Is there a way to add an x in a when you click in a cell in a

range
like
B3:G99 only and not the whole sheet? Right now I can do it to the

whole
sheet
with
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveCell.Value = "x"
End Sub
Thanks!








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
Click on graph bar to execute a double-click in a pivot table cell [email protected] Charts and Charting in Excel 4 August 3rd 05 01:37 AM
Mouse Over Graph, Capture Information on Click(Double Click) Dean Hinson[_3_] Excel Programming 1 December 6th 04 04:49 AM
Click-event question Steph[_3_] Excel Programming 3 November 11th 04 03:49 PM
Double-click event question, part 2 (Excel 97) Bob Wall Excel Programming 1 September 11th 04 03:50 AM
Double-click Event question Bob Wall Excel Programming 2 September 6th 04 03:21 AM


All times are GMT +1. The time now is 12:20 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"