ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Quick method to add absolute references in Excel using keyboard (https://www.excelbanter.com/excel-discussion-misc-queries/12632-quick-method-add-absolute-references-excel-using-keyboard.html)

photon63

Quick method to add absolute references in Excel using keyboard
 
It would be useful for absolute references to be added in Excel when holding
a key down on the keyboard, instead of having to re-edit each cell every
time. Say, hold down the mouse button, press 'r' to toggle rows between
absolute and relative, and the same for 'c' and columns.

Smuggy

Here's an excellent routine for you, gives you two subroutines Reltoabs and
Abstorel which you could then assign to keyboard shortcut or to an icon on
toolbar...

Sub ReltoAbs()
Dim Cell As Range
For Each Cell In Selection
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlAbsolute)
Next
End Sub

Sub AbstoRel()
Dim Cell As Range
For Each Cell In Selection
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlRelative)
Next
End Sub

Sub RelColAbsRows()
Dim Cell As Range
For Each Cell In Selection
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlAbsRowRelColumn)
Next
End Sub

Sub RelRowsAbsCol()
Dim Cell As Range
For Each Cell In Selection
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlRelRowAbsColumn)
Next
End Sub


Steve
PS. I wish I could claim the credit for this, but I can't - thought I would
post it for you anyway.




"photon63" wrote:

It would be useful for absolute references to be added in Excel when holding
a key down on the keyboard, instead of having to re-edit each cell every
time. Say, hold down the mouse button, press 'r' to toggle rows between
absolute and relative, and the same for 'c' and columns.


photon63

Thanks - much appreciated :)

"Smuggy" wrote:

Here's an excellent routine for you, gives you two subroutines Reltoabs and
Abstorel which you could then assign to keyboard shortcut or to an icon on
toolbar...

Sub ReltoAbs()
Dim Cell As Range
For Each Cell In Selection
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlAbsolute)
Next
End Sub

Sub AbstoRel()
Dim Cell As Range
For Each Cell In Selection
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlRelative)
Next
End Sub

Sub RelColAbsRows()
Dim Cell As Range
For Each Cell In Selection
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlAbsRowRelColumn)
Next
End Sub

Sub RelRowsAbsCol()
Dim Cell As Range
For Each Cell In Selection
Cell.Formula = Application.ConvertFormula(Cell.Formula, xlA1, xlA1,
xlRelRowAbsColumn)
Next
End Sub


Steve
PS. I wish I could claim the credit for this, but I can't - thought I would
post it for you anyway.




"photon63" wrote:

It would be useful for absolute references to be added in Excel when holding
a key down on the keyboard, instead of having to re-edit each cell every
time. Say, hold down the mouse button, press 'r' to toggle rows between
absolute and relative, and the same for 'c' and columns.



All times are GMT +1. The time now is 02:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com