Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default The difference between the enter key and .Calculate (perhaps Evaluate?)

Hi microsoft.public.excel.programming newsgroup, this is my first time here.

I'm developing an event driving application in Excel, mostly controlled by
the keyboard, namely ALT+(cursor keys), and I have this function on Module1
of a .xls:

Public Function gini()
MsgBox "do instructions here"
gini = Replace(Application.Caller.Formula, "=", ".")
End Function

and on ThisWorkbook I have the following event:

Public Sub Workbook_Open()
Application.OnKey "%{RIGHT}", "parseOnce"
Application.OnKey "%{DOWN}", "parseForever"
End Sub

the parseOnce() is as follows:

Public Function parseOnce(Optional cell As Range)
Set iPtr = IIf(cell Is Nothing, ActiveCell, cell)
hasParsed = False

If iPtr.HasFormula = True Then
iPtr.Calculate
hasParsed = True
End If

parseOnce = hasParsed
End Function

iPtr (shorthand for instruction pointer) is a Range type variable either
containing the ActiveCell of the cell passed as an argument to parseOnce().
Issuing iPtr.Calculate does exactly what I want, it displays the message "do
instructions here". However, pressing Enter after entering the =gini()
formula does the same thing, and that I don't want.

My question is, how can I execute (or calculate?) a formula/function on
pressing ALT+(right-arrow), without executing it when it is entered on the
cell ? When using Excel's shortcut Alt+Shift+Ctrl+F9 (Re-calculate all),
any of these functions shouldn't run either, they should only run with the
ALT+key combination. Any other Excel formula, for example =SUM() should run
when entered, or re-calculated.

I hope you can help me and thank you for reading so far, sincere regards,
Marco

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the difference between use the enter key vs the enter box Rosa New Users to Excel 3 January 20th 09 02:01 PM
how to calculate time difference in hh:mm:ss bobby t Excel Discussion (Misc queries) 6 July 19th 07 02:48 PM
calculate difference between two times Ken Excel Worksheet Functions 6 July 21st 06 09:05 PM
evaluate two cells and calculate based on criteria galiant Excel Worksheet Functions 6 July 10th 06 04:21 PM
How do I set a formula to show a difference in sets of data enter trivera42273 Excel Worksheet Functions 0 February 13th 06 08:41 PM


All times are GMT +1. The time now is 04:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"