# MSExcel questio



## winwintoo (Nov 9, 2004)

Please be gentle. I used to be a programmer, but I've been away from it for several years. I'm not afraid to do the heavy lifting, but I need to be pointed in the right direction.

Is it possible to detect a mouse click in a cell in an Excel worksheet?

I have a list of words in column A. If I click on a cell in column A, I want the word in that column to move or copy to column B.

I've googled but can't find an answer. There are some suggestions of using VBA which I might have to resort to using, but that's a bit much for my current needs.

If this isn't possible, does anyone know of a really lean database app? There used to be lots that were in early development, but the ones I know have all gone commercial and my needs are modest so spending a load of money isn't practical.

Thanks


----------



## Rob (Sep 14, 2002)

I'm not aware of an Excel function that can pick up a mouse click. You could probably make something that would work using a VBA macro, but I don't see that being easy.

Have you considered a dropdown menu tied to column A? Create a dropdown menu, and then use column A as your source list. Choose the column A item from the dropdown menu, and then perform the action. You still might have to create a macro for the copy action, but it should be fairly easy.


----------



## winwintoo (Nov 9, 2004)

Rob said:


> I'm not aware of an Excel function that can pick up a mouse click. You could probably make something that would work using a VBA macro, but I don't see that being easy.
> 
> Have you considered a dropdown menu tied to column A? Create a dropdown menu, and then use column A as your source list. Choose the column A item from the dropdown menu, and then perform the action. You still might have to create a macro for the copy action, but it should be fairly easy.


Thanks Rob. I was afraid that it wouldn't be easy in VBA. I wonder if it has something to do with Mac OS invoking action on mouse up while winOS invokes on mouse down. Or has that changed?

I could have done what I want to do blindfolded in early versions of 4D or even FileMaker. I guess I'll have to put my thinking cap on.

Your suggestion of a drop down menu in Excel is interesting, I'll give that a try.


----------



## Rob (Sep 14, 2002)

I guess it wouldn't be hard to use a mouse click in VBA if you could find the information on how to do it. I've got lot's of experience using VBA in Excel, but I've never used a mouse click in the way you're describing. That doesn't mean that it can't be done, however.

If you couldn't find an answer easily through a search, then that usually means it can't be done easily, or it's an unusual approach.


----------



## winwintoo (Nov 9, 2004)

Rob said:


> I guess it wouldn't be hard to use a mouse click in VBA if you could find the information on how to do it. I've got lot's of experience using VBA in Excel, but I've never used a mouse click in the way you're describing. That doesn't mean that it can't be done, however.
> 
> If you couldn't find an answer easily through a search, then that usually means it can't be done easily, or it's an unusual approach.


In most languages, its usually something like "onclick" or "mousedown" or "mouseup" but I can't find anything like that.

What I want to do is make a little interface that would have a list of words and the program would show the words one at a time. The user would accept or reject the word. Words that are accepted would be saved and after all the words were shown, then the saved words would be shown and either saved or rejected. This would repeat until only three words remain in the saved list.

It's a pet project of mine, but I keep getting distracted from really working on it. I think it would work well as an iThing app, but that's a whole different learning project.


----------



## Rob (Sep 14, 2002)

From your description I would write a macro that gets activated by a button. When the macro is activated you would use msgbox with O.K./Cancel. A small window would show up with the word, and the user would have the option to accept it by clicking on the O.K. button, or to reject it by clicking on the Cancel button. It would be an extremely simple looping operation, needing only a few lines of code.

It looks like Excel does have a VBA function that will work in the way you originally described. It's called a SelectionChange event. It looks like it wouldn't be that difficult. Here are some links that will help. Each one of the links isn't great on it's own, but after looking at all three it becomes clear how it would work.

SelectionChange Event [Excel 2003 VBA Language Reference]



[ame=http://www.youtube.com/watch?v=SCayvF5lxfY]Excel 2010 VBA Tutorial 35 - Events - Selection Change - YouTube[/ame]



VBA: Can VBA recognise mouse click event?

The third link refers to a different event, but shows how you can limit the actions to a specific group of cells.


----------



## WCraig (Jul 28, 2004)

I suspect you could do what you want with pure Applescript. Display a dialog with a list containing your words. On double-click, remove the selected word from the list and keep repeating until the user cancels or the list contains 3 items. Then write the 3 items to a test file...

Implementation is a left as an exercise for the reader! 

Craig


----------



## winwintoo (Nov 9, 2004)

Rob said:


> From your description I would write a macro that gets activated by a button. When the macro is activated you would use msgbox with O.K./Cancel. A small window would show up with the word, and the user would have the option to accept it by clicking on the O.K. button, or to reject it by clicking on the Cancel button. It would be an extremely simple looping operation, needing only a few lines of code.
> 
> It looks like Excel does have a VBA function that will work in the way you originally described. It's called a SelectionChange event. It looks like it wouldn't be that difficult. Here are some links that will help. Each one of the links isn't great on it's own, but after looking at all three it becomes clear how it would work.
> 
> ...


Thanks again Rob. Some good ideas there. Now I know where to look. My old programming muscles are starting to wake up.

Too bad the mrexcel board is closed to new registrations, but the youtube is promising. He seems to have a lot of videos. I'm sure I'll learn a lot.


----------



## winwintoo (Nov 9, 2004)

WCraig said:


> I suspect you could do what you want with pure Applescript. Display a dialog with a list containing your words. On double-click, remove the selected word from the list and keep repeating until the user cancels or the list contains 3 items. Then write the 3 items to a test file...
> 
> Implementation is a left as an exercise for the reader!
> 
> Craig


I never thought of Applescript, but that's an idea. I'll look into that.


----------

