VBA/Macros in Cell Edit mode / Formula text selectio

B

bulk88

Why doesn't a macro run when I am in cell edit/formula edit mode? How
can i get one to run in Cell edit mode?

Also, how can I get what a user highlight/selected with a mouse or
shift+arrow keys in VBA?

The Selection Object in Excel seems to only work on Cells, not Cell
contents/text/formulas.
 
G

Guest

Answer to first question is that macros do not run while in cell edit mode.

Second question:-
ActiveCell.Value returns the value of the selected cell. Because Value is
the default you may simply use ActiveCell to return the value of the cell.

ActiveCell.Formula returns the formula that is in the selected cell.

Examples:-
'to return the value of the active cell in a message box.
MsgBox "Activecell = " & ActiveCell

'To return the formula in the active cell in a message box.
MsgBox "Activecell = " & ActiveCell.Formula

To get the syntax for placing values and formulas in cells using a macro,
try recording macros to do it.

Regards,

OssieMac


Ms
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top