I am trying to restrict a cell so all that happens when clicked is an X to appear in that cell. I'm new to this so the simpler the better. Thanks!!
I am trying to restrict a cell so all that happens when clicked is an X to appear in that cell. I'm new to this so the simpler the better. Thanks!!
Hi slimjim,
Do you want ANY cell that is clicked to show an X, or just certain cells?
I guess certain cells, but it is the majority of the worksheet. So far only column A and Row 1 have content in them and I think the rest can be made so that only an X appears when selected(and disappear when selected again). I'm basically trying to make a check list.
Ok. The following code, pasted into the worksheet's code module, will add or remove an X from a cell when you double-click on it. If you really want just a single-click we could use the Worksheet_SelectionChange event, however that gets triggered every time your cell selection changes (using mouse, arrows, tab, enter, etc.) and you could start adding X's all over the place if you're not careful.
This will add or remove an X from any cell when double-clicked as long as it's not in column A or row 1. (B2:IV65536 is fair game).![]()
Please Login or Register to view this content.
Update: Added 'Cancel = True' so that the cell is deactivated after double-clicking, leaving just the X or blank (taking you out of cell edit mode).
Last edited by Paul; 02-21-2008 at 01:18 AM.
When you say code module do you mean Macros?![]()
Yep.
1. Right-click on the sheet tab for which you want to add this code. e.g. If you want this code to run on 'Sheet1', right-click on that tab then select 'View Code'.
2. In the VB Editor window that appears, paste the code I provided into the right-hand window
3. Close the VB Editor window
4. Double-click any cell in row 2 or below, or column B and to the right.
Paul,
I appreciate all your help on this, but it doesn't look like its working. It looks like the code is recognized cause it has Blue text(I copied it funky the first time and it was all red) but when I double click a cell it just gives me the option to type in it.
Can you zip and upload a copy of your workbook to the thread? I can take a look at it for you then.
Again, thanks for your help. Your Avatar is exactly how I feel btw. =)
Ok thats wierd I just tried copying and pasting again and now it works....
Yes!!
It works for sure. I opened a new workbook and created the same checklist and pasted your code. I must have done something wierd on the first workbook when I was searching through all the functions and stuff to try to figure this out. Thanks for putting up with this excel noob!![]()
Glad you got it working now. It's my pleasure to help when I can.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks