Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Posts: 84
Default Input Text Upon Click Of Cell

Hey all,

I'm wanting to just click on a cell and it automatically input "P", kind of like a option button. I have a column set up so that if there is a "P" in the cell I can sort the sheet to show only those rows with "P". I'm wanting to just click on a cell in that column and it input "P" so I don't have to type it in. I hope that's explaining it clearly enough.

Any ideas?

Keyrookie
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 695
Default Input Text Upon Click Of Cell

Put in sheet's code module
if u double click a P is inserted but only in column B change B:B if u want
another

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
If Target = Empty Then Target = "P"
End Sub



"Keyrookie" skrev:


Hey all,

I'm wanting to just click on a cell and it automatically input "P",
kind of like a option button. I have a column set up so that if there
is a "P" in the cell I can sort the sheet to show only those rows with
"P". I'm wanting to just click on a cell in that column and it input
"P" so I don't have to type it in. I hope that's explaining it clearly
enough.

Any ideas?

Keyrookie




--
Keyrookie

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Input Text Upon Click Of Cell

How about a double-click?

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
Const MY_RANGE As String = "A1:A100"
Dim cell As Range
On Error GoTo endit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(MY_RANGE)) Is Nothing Then
Target.Value = "P"
End If
Cancel = True
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste into that sheet module.

Adjust MY_RANGE to suit.


Gord Dibben MS Excel MVP

On Sat, 22 Sep 2007 17:45:38 +0100, Keyrookie
wrote:


Hey all,

I'm wanting to just click on a cell and it automatically input "P",
kind of like a option button. I have a column set up so that if there
is a "P" in the cell I can sort the sheet to show only those rows with
"P". I'm wanting to just click on a cell in that column and it input
"P" so I don't have to type it in. I hope that's explaining it clearly
enough.

Any ideas?

Keyrookie


  #4   Report Post  
Member
 
Posts: 84
Default

Thank you Gord, it worked perfectly! Can I do it for more than 1 column on the same sheet?

Keyrookie


Quote:
Originally Posted by Gord Dibben View Post
How about a double-click?

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
Const MY_RANGE As String = "A1:A100"
Dim cell As Range
On Error GoTo endit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(MY_RANGE)) Is Nothing Then
Target.Value = "P"
End If
Cancel = True
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste into that sheet module.

Adjust MY_RANGE to suit.


Gord Dibben MS Excel MVP

On Sat, 22 Sep 2007 17:45:38 +0100, Keyrookie
wrote:


Hey all,

I'm wanting to just click on a cell and it automatically input "P",
kind of like a option button. I have a column set up so that if there
is a "P" in the cell I can sort the sheet to show only those rows with
"P". I'm wanting to just click on a cell in that column and it input
"P" so I don't have to type it in. I hope that's explaining it clearly
enough.

Any ideas?

Keyrookie
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Input Text Upon Click Of Cell

Const MY_RANGE As String = "A:A,D:D"

or whatever columns or ramges in those columns you wish.

Const MY_RANGE As String = "A1:A100, D23:D97"


Gord

On Sun, 23 Sep 2007 04:43:38 +0100, Keyrookie
wrote:


Thank you Gord, it worked perfectly! Can I do it for more than 1
column on the same sheet?

Keyrookie


Gord Dibben;559497 Wrote:
How about a double-click?

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
Const MY_RANGE As String = "A1:A100"
Dim cell As Range
On Error GoTo endit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(MY_RANGE)) Is Nothing Then
Target.Value = "P"
End If
Cancel = True
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View
Code".

Copy/paste into that sheet module.

Adjust MY_RANGE to suit.


Gord Dibben MS Excel MVP

On Sat, 22 Sep 2007 17:45:38 +0100, Keyrookie
wrote:
-

Hey all,

I'm wanting to just click on a cell and it automatically input "P",
kind of like a option button. I have a column set up so that if

there
is a "P" in the cell I can sort the sheet to show only those rows

with
"P". I'm wanting to just click on a cell in that column and it input
"P" so I don't have to type it in. I hope that's explaining it

clearly
enough.

Any ideas?

Keyrookie-


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 do I input text into excel worksheet cell? KVJ New Users to Excel 2 September 3rd 06 05:26 PM
reight click a cell without exiting from input mode Khoshravan Setting up and Configuration of Excel 2 April 9th 06 01:24 AM
excel cell text input jnieurzyla New Users to Excel 1 April 4th 06 05:50 PM
On click, copy text into another cell - XL2K Bob the Builder Excel Worksheet Functions 2 March 16th 05 10:03 PM
Using text value in cell as input for another Alan Excel Worksheet Functions 1 November 26th 04 02:38 AM


All times are GMT +1. The time now is 06:26 PM.

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"