Link to home
Start Free TrialLog in
Avatar of easycapital
easycapitalFlag for Macao

asked on

Keyboard short cuts to run macros

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

ASKER CERTIFIED SOLUTION
Avatar of SiddharthRout
SiddharthRout
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of easycapital

ASKER

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
SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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  
Thanks,
JP