Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
keyboard press indication
Hi,
i need the macro to distinguish between a user press and a macro input is it posible to have a function that indicate a keyboard press? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
keyboard press indication
I don't think you can check on individual keystrokes, but below is a method
I posted in the past that will allow you to decide if the input came from the user or a macro. Create a Public Boolean variable in a Module, set it to True at the start of **all** your macros, check the variable in the Change event and, at the end of the change event, set the variable back to False. Here is a very simple example... In a Module =========================== Public InModule As Boolean In a Macro =========================== Sub MyMacro() InModule = True Range("A1").Value = "Where did I come from?" ' ' Actual code goes here ' End Sub In Worksheet Change event =========================== Private Sub Worksheet_Change(ByVal Target As Range) If Not InModule Then MsgBox "Cell was **NOT** changed by a macro" ' ' Actual code goes here ' Else MsgBox "Cell changed by a macro" ' ' Actual code goes here ' End If InModule = False End Sub Try typing an entry into a cell and then run the MyMacro macro. -- Rick (MVP - Excel) "thread" wrote in message ... Hi, i need the macro to distinguish between a user press and a macro input is it posible to have a function that indicate a keyboard press? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Indication that there is a # cell value in the range | Excel Programming | |||
Cell has focus but no indication that it does. | Excel Programming | |||
screen position indication? | Excel Discussion (Misc queries) | |||
Autofilter indication when being used | Excel Discussion (Misc queries) | |||
time indication bar | Excel Programming |