Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default How to make a table with only one cell to be selected?

Works like a charm man! REALLY REALLY thanks! Just a question: is there any
way to make it work like if I had hit enter after typing the "x"? Right now
when I type the X on the box I have to either press enter or select a
different column for the script to run. Just a "lazyness" question =)

But as I don't know VB programming I'd like to learn a bit... I was looking
your code, and I couldn't identify where it says that only the "x" can do the
selection, since I tried with other stuff and it didn't work (not that I want
to, I just tested... x works as I wanted). I also didn't get where it
specifies that I can have two X's, one in each column, but not 2 x's in the
same column, or how the x in the first column doesn't exclude the x in the
second column.

Thanks in advance!





"vezerid" wrote:

You can use the following VBA event procedure for this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A2:B13")) Is Nothing Then
v = Target.Value
col = Target.Column
Application.EnableEvents = False
Range(ActiveSheet.Cells(2, col), ActiveSheet.Cells(13,
col)).ClearContents
Target.Value = v
Application.EnableEvents = True
End If
End Sub

To install: Right click on the sheet tab. Choose View Code... This
takes you to the VBA IDE.
Paste the above code in the window. It should operate like you want
from this point on.

HTH
Kostis Vezerides

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default How to make a table with only one cell to be selected?

Okay, I think I had a slight idea... please tell me if I am right

Application.EnableEvents = False
Range(ActiveSheet.Cells(2, col), ActiveSheet.Cells(13, col)).ClearContents
Target.Value = v
Application.EnableEvents = True

That makes the cells on the range specified (I only can't get how it knows 2
and 13 means from A2 to B13, since you only use 1 value for the column, which
is col) forbid any changes, then be cleared, then it puts the char I typed on
the cell I typed it, and finally allow changes again



"ghnogueira" wrote:

Works like a charm man! REALLY REALLY thanks! Just a question: is there any
way to make it work like if I had hit enter after typing the "x"? Right now
when I type the X on the box I have to either press enter or select a
different column for the script to run. Just a "lazyness" question =)

But as I don't know VB programming I'd like to learn a bit... I was looking
your code, and I couldn't identify where it says that only the "x" can do the
selection, since I tried with other stuff and it didn't work (not that I want
to, I just tested... x works as I wanted). I also didn't get where it
specifies that I can have two X's, one in each column, but not 2 x's in the
same column, or how the x in the first column doesn't exclude the x in the
second column.

Thanks in advance!





"vezerid" wrote:

You can use the following VBA event procedure for this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A2:B13")) Is Nothing Then
v = Target.Value
col = Target.Column
Application.EnableEvents = False
Range(ActiveSheet.Cells(2, col), ActiveSheet.Cells(13,
col)).ClearContents
Target.Value = v
Application.EnableEvents = True
End If
End Sub

To install: Right click on the sheet tab. Choose View Code... This
takes you to the VBA IDE.
Paste the above code in the window. It should operate like you want
from this point on.

HTH
Kostis Vezerides

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
Is there a way to make a cell stand out when it is selected gkhutton Excel Discussion (Misc queries) 1 November 10th 06 02:30 AM
how do i make a drop down list of selected names no repeatition Mehboob Ellahi Excel Worksheet Functions 2 December 30th 05 04:31 PM
how do i make it so that when a sheat is selected either via link or tab, that xlLastCell is selected. the last on the sheet. Daniel Excel Worksheet Functions 1 July 12th 05 01:30 AM
how read value from last selected cell? It is possible? how get adress last selected cell? Andrzej New Users to Excel 4 May 30th 05 07:28 PM
Finding min,max in an array using selected rows from a table Dazed and confused about min, max Excel Worksheet Functions 1 February 25th 05 09:02 PM


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

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

About Us

"It's about Microsoft Excel"