Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jolly Rogers
 
Posts: n/a
Default macro for "entering data"

Can anyone suggest a good macro to allow me to select (touch) any cell in
a given range, and have the alpha character "X" (capitalized) appear in
the cell when the cell is selected?

For example, let's consider cell A1. A1 is initially blank and void of
any formulas. If I select A1 with my mouse, I want "X" to appear in A1.
If I select A1 again, I want X to disappear from A1, and so forth and so
on.

(Note: For my purposes, I prefer not to use a checkbox or radio buttons
because I already have conditional formatting depending on the contents of
the cells which will either have X or not.)

Thanks much!

Joseph


  #2   Report Post  
papou
 
Posts: n/a
Default

Hi Joseph
May be this could do?
Right-click on worksheet tab, choose View Code and paste the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address < "$A$1" Then Exit Sub
If Target.Value = "" Then
Target.Value = "X"
Else: Target.Value = "": End If
End Sub

PS: this will only work when the cell is actually selected (either with left
click from mouse or with keyboard arrow)

HTH
Cordially
Pascal

"Jolly Rogers" a écrit dans le message de news:
TzJRd.20157$Zr.9346@okepread03...
Can anyone suggest a good macro to allow me to select (touch) any cell in
a given range, and have the alpha character "X" (capitalized) appear in
the cell when the cell is selected?

For example, let's consider cell A1. A1 is initially blank and void of
any formulas. If I select A1 with my mouse, I want "X" to appear in A1.
If I select A1 again, I want X to disappear from A1, and so forth and so
on.

(Note: For my purposes, I prefer not to use a checkbox or radio buttons
because I already have conditional formatting depending on the contents of
the cells which will either have X or not.)

Thanks much!

Joseph




  #3   Report Post  
Jolly Rogers
 
Posts: n/a
Default

That works beautifully. Thanks.

How could I do the same thing for individual cells in a range though?
Say, anytime a cell in range $A1:$A100 is selected, it toggles on (or off)
with "X"?

Thanks again.

Joseph

"papou" wrote in message
...
Hi Joseph
May be this could do?
Right-click on worksheet tab, choose View Code and paste the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address < "$A$1" Then Exit Sub
If Target.Value = "" Then
Target.Value = "X"
Else: Target.Value = "": End If
End Sub

PS: this will only work when the cell is actually selected (either with
left click from mouse or with keyboard arrow)

HTH
Cordially
Pascal

"Jolly Rogers" a écrit dans le message de news:
TzJRd.20157$Zr.9346@okepread03...
Can anyone suggest a good macro to allow me to select (touch) any cell
in a given range, and have the alpha character "X" (capitalized) appear
in the cell when the cell is selected?

For example, let's consider cell A1. A1 is initially blank and void of
any formulas. If I select A1 with my mouse, I want "X" to appear in
A1. If I select A1 again, I want X to disappear from A1, and so forth
and so on.

(Note: For my purposes, I prefer not to use a checkbox or radio
buttons because I already have conditional formatting depending on the
contents of the cells which will either have X or not.)

Thanks much!

Joseph






  #4   Report Post  
Gord Dibben
 
Posts: n/a
Default

Joseph

Try this variation.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
If Target.Value = "" Then
Target.Value = "X"
Else: Target.Value = ""
End If
End With
End If
End Sub


Gord Dibben Excel MVP

On Sat, 19 Feb 2005 10:45:55 -0600, "Jolly Rogers"
wrote:

That works beautifully. Thanks.

How could I do the same thing for individual cells in a range though?
Say, anytime a cell in range $A1:$A100 is selected, it toggles on (or off)
with "X"?

Thanks again.

Joseph

"papou" wrote in message
...
Hi Joseph
May be this could do?
Right-click on worksheet tab, choose View Code and paste the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address < "$A$1" Then Exit Sub
If Target.Value = "" Then
Target.Value = "X"
Else: Target.Value = "": End If
End Sub

PS: this will only work when the cell is actually selected (either with
left click from mouse or with keyboard arrow)

HTH
Cordially
Pascal

"Jolly Rogers" a écrit dans le message de news:
TzJRd.20157$Zr.9346@okepread03...
Can anyone suggest a good macro to allow me to select (touch) any cell
in a given range, and have the alpha character "X" (capitalized) appear
in the cell when the cell is selected?

For example, let's consider cell A1. A1 is initially blank and void of
any formulas. If I select A1 with my mouse, I want "X" to appear in
A1. If I select A1 again, I want X to disappear from A1, and so forth
and so on.

(Note: For my purposes, I prefer not to use a checkbox or radio
buttons because I already have conditional formatting depending on the
contents of the cells which will either have X or not.)

Thanks much!

Joseph






  #5   Report Post  
Jolly Rogers
 
Posts: n/a
Default

Perfect. Works flawlessly. Thanks much, Gord.

Joseph

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Joseph

Try this variation.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
If Target.Value = "" Then
Target.Value = "X"
Else: Target.Value = ""
End If
End With
End If
End Sub




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
External data Macro Problem Excel 97 Craig Kelly Excel Discussion (Misc queries) 1 January 17th 05 03:17 PM
Macro does not run when data refreshed Larry Lehman Excel Discussion (Misc queries) 0 January 16th 05 07:31 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
I need a macro to find cut and paste data to new cell Rex Excel Discussion (Misc queries) 0 December 6th 04 12:45 AM
Daily Macro to Download Data, Order and paste in order Iarla Excel Worksheet Functions 1 November 17th 04 01:59 PM


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