How?

L

Lee and Rebecca

Can you help me with this? I don't understand what to do from that web site.
 
A

Art

Lee & Rebecca

Try this:

The first step is to get to the Visual Basic Editor. You can press Alt-F11
or use Tools, Macro, Visual Basic Editor.

You should see a screen with a bunch of stuff on it. In the upper left you
should see a window that says Project-VBA Project. In that window you should
see a list of the worksheets in your file. I'm not 100% sure the window will
have the title Project-VBA Project, but you must see that list of worksheets.

If you do not see this window, got to View, and click Project Explorer. Now
double click on the worksheet you want to work with.

This should make a window appear on the right, and at the top it will
probably have two boxes, one that says (General) and one that says
(Declarations). Click the one that says (General) and select Worksheet.

The box that said (Declarations) should now say SelectionChange, and there
will be a large window below those words. It may start with Option Explicit.
Next you'll see:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

Between those two statements type the following:

Selection="X"

That should do it.

Art
 
L

Lee and Rebecca

Art, that worked however it puts "X" in every cell I click on. Can I make it
put an X in only selected cells?
 
A

Art

Art, that worked however it puts "X" in every cell I click on. Can I make it
put an X in only selected cells?


No problem, except that depending upon what cells you want this to work for
it can get messy. You'll need an If Statement surrounding the original
statement you typed in.

Suppose that you want the X to appear if you click in a cell in columns C to
E, and for rows 4 to 6. You can do the following:

If target.column>=3 and target.column<=5 and _
target.row>=4 and target.row<=6 then
selection="X"
end if

Notice a few things. First, at the end of my first line there is a space
and an underscore. That's how you contnue the statement to the next line.
You don't have to do this, you can just string it out (probably up to 255
characters), but it usually makes for a more readable statement. If you do
do it, don't forget the space before the underscrore.

I indented selection="X" -- that's not necessary, but again improves
readability.

Finally, if you're conditions are much more complicated you can next the if
statements -- and if they're too complicated for that we can come up with
some other solution.

Art
 
D

Dave Peterson

There's nothing that can be done just by clicking.

You could do it based on a doubleclick or rightclick -- but maybe this
alternative will work.

Select your range that should have this behavior (I'm gonna use column A).

Format|Cells|number tab|custom category
In the Type box, put this:
X;X;X;X

Now, anything you type in will look like an X (spacebar, x, Lee, anything!)

And if you want to find out if a cell is an X, you'll have to use something
like:

=if(a1="","nope","Yep")

(hitting the delete key on the keyboard will clear the cell)

Another alternative--if you want something that looks like a checkmark:

Format|Cells|number tab|custom category
In the "type:" box, put this:

alt-0252;alt-0252;alt-0252;alt-0252

But hit and hold the alt key while you're typing the 0252 from the numeric
keypad.

It should look something like this when you're done.
ü;ü;ü;ü
(umlaut over the lower case u separated by semicolons)

And format that range of cells as Wingdings.

All that other stuff still applies.
 
Top