Solved

Keyboard short cuts to run macros

Posted on 2011-02-16
5
229 Views
Last Modified: 2012-05-11
Below are two set of macros; to make selected cells absolute and relative respectively.  I want to add them to the XSTART location so that it forms part of the macros that are available to be used.  What exactly needs to be done so that a keyboard short cut will run either one.  I had this working before, but I do not recall how it was done.
Thanks,
JP
 
Sub MakeRowAbsolute()
    Dim rngCell As Range
    For Each rngCell In Selection
        rngCell.Formula = Application.ConvertFormula(rngCell.Formula, xlA1, xlA1, xlAbsRowRelColumn)
    Next rngCell
End Sub
Sub MakeRelative()
    Dim rngCell As Range
    For Each rngCell In Selection
        rngCell.Formula = Application.ConvertFormula(rngCell.Formula, xlA1, xlA1, xlRelative)
    Next rngCell
End Sub
Sub setKey()
    Application.OnKey "^+%4", "MakeRowAbsolute"
End Sub
What is "^+%4"?

Open in new window

0
Comment
Question by:easycapital
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 250 total points
ID: 34912304
Hope this helps.

http://personal-computer-tutor.com/personalxls.htm

You have to call the line

Application.OnKey "^+%4", "MakeRowAbsolute"

from the workbook open event.

^ stands for control
+ stands for shift

for more on key combination see this,

http://www.rondebruin.nl/key.htm

Sid
0
 

Author Comment

by:easycapital
ID: 34912814
I read the links.  The 2nd link was very helpful to explain the meaning of the control, shift, etc. Thanks!

The first link mentions to place the file in the XLSTART directory - but to avoid depending on the IT department to save it there, I am telling excel to run files in a directory chosen by me.  I can explain where I do this in excel if necessary.  How can I have the embedded file run from that location specified in excel.

Please verify that the macro sets the values as absolute, then it removes the absolute reference if run again.

Thanks,
JP M---Row-anchors-then-remove-it-.xls
0
 
LVL 85

Assisted Solution

by:Rory Archibald
Rory Archibald earned 250 total points
ID: 34914637
Just put the file in whatever folder you have specified as an alternate startup folder. You also don't really need OnKey - you can simply open the file, open the macros dialog (Alt+f8), select the macro and then click the Options... button and assign the key combination you want.
0
 

Author Comment

by:easycapital
ID: 34915311
Rorya, Good point.  Though I want to assign my macros a Control, Shift, Alt PLUS another key - to help avoid other macros (of course, it may still conflict, but it is a start).  

Could try to make it so that upon hitting Control + Shift + Alt + 4, it makes the selected cells absolute, then the second time, it makes the selected cells relative.

I am very interested start to manage my own set macro short cuts.
Thanks,
JP  
0
 

Author Closing Comment

by:easycapital
ID: 35000508
Thanks,
JP
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question