Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Calling Excel shortcuts from VBA

Hi,

I am trying to automate the following two excel shortcuts using VBA. I know I
can use commandbar and commandcontrol to call excel menus but I can not find
the submenus these shortcuts belong to.

1. Ctrl + [ -- cursor goes to the precedent cell

2. F5 + Enter -- cursor goes to the original cell


Also, is it possible to call an excel shortcut from VBA? I know that one can
call a worksheet function from VBA (For example, Application.
WorksheetFunction.Fact(5) ). But is there way to call a shortcut, say Ctrl +
C from VBA?

Thanks,

MG.

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Calling Excel shortcuts from VBA

VBA is pretty straight forward in moving the cursor to cells.

Range("C5").Select

The above VBA command puts the cursor in cell C5. You can also use the GoTo
method to move the cursor to specific cells.

As for the precedent and original cells. You have to define these cells in
code with a variable.

myPcell = ActiveCell
myPcell.Select

myPcell variable will hold the address of that ActiveCell, no matter which
other cells become the active cell thereafter. So when you select myPcell,
it will return to that original active cell.

Shortcut keys are usually assigned to functions and procedures (macros) that
a user needs to call periodically to perform a specific action in a
worksheet. These procedures have a title line with a name that appears in
the dialog box which can be displayed by clicking Tools Macro Macros in
Excel. There is more than one way to call them from VBA.

1. Just the Name
macro1
This can be used if there is no argumentr to be passed to the
procedure.

2. Using Call
Call macro1
When Call is used when passing arguments to be enclosed in parentheses.
If you use
the key word Call, then you must use the parentheses, even if there are
no arguments.

3. Using Run
Application.Run("<path!macro1", <arg)
This method allows you to run a macro from another workbook.

These are all explained in more detail in the VBA help files. Just type in
keyword Call or Run to view the topic list, then select the topic from the
list.






"musicgold via OfficeKB.com" <u40543@uwe wrote in message
news:a84938e907762@uwe...
Hi,

I am trying to automate the following two excel shortcuts using VBA. I
know I
can use commandbar and commandcontrol to call excel menus but I can not
find
the submenus these shortcuts belong to.

1. Ctrl + [ -- cursor goes to the precedent cell

2. F5 + Enter -- cursor goes to the original cell


Also, is it possible to call an excel shortcut from VBA? I know that one
can
call a worksheet function from VBA (For example, Application.
WorksheetFunction.Fact(5) ). But is there way to call a shortcut, say Ctrl
+
C from VBA?

Thanks,

MG.

--
Message posted via http://www.officekb.com



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Calling Excel shortcuts from VBA

JLGWhiz,

Thanks. I know basic fundamentals related to macros in Excel.

The shortcuts I mentioned in my original message are Excel shorcuts. I am not
able to find the functions underlying them. I want to be able to execute
those shortcuts inside a macro.

MG.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/201005/1

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
Calling Excel shortcuts from VBA M G Excel Programming 1 May 20th 10 04:48 PM
New shortcuts in Excel 2007 Robert Gelbmann Excel Discussion (Misc queries) 1 February 22nd 08 11:19 AM
85 Keyboard Shortcuts for Excel Doug Kanter Excel Discussion (Misc queries) 1 April 28th 06 02:35 PM
shortcuts in Excel SamelaD Excel Worksheet Functions 1 October 9th 05 05:58 PM
shortcuts to excel files. nitm Excel Programming 11 February 14th 05 05:37 PM


All times are GMT +1. The time now is 10:09 PM.

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"