ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Macro (https://www.excelbanter.com/excel-programming/427905-help-macro.html)

Simon S[_2_]

Help with Macro
 
Hi,

I am new to macros and I need some help

I regularly have to change the reference style from x1A1 to x1R1C1 and back
again. So I made the following macro using Ctrl+Shift+T as the keyboard
short cut

Application.ReferenceStyle = xlR1C1
End Sub

Is there a way I can get it to toggle, i.e. each time I press Ctrl+Shift+T
it will change to other reference style, if I am in x1A1 it will change to
x1R1C1 and vice versa

Thanks


Rick Rothstein

Help with Macro
 
This single statement will toggle between the two settings...

Application.ReferenceStyle = (xlR1C1 + xlA1) - Application.ReferenceStyle

--
Rick (MVP - Excel)


"Simon S" wrote in message
...
Hi,

I am new to macros and I need some help

I regularly have to change the reference style from x1A1 to x1R1C1 and
back
again. So I made the following macro using Ctrl+Shift+T as the keyboard
short cut

Application.ReferenceStyle = xlR1C1
End Sub

Is there a way I can get it to toggle, i.e. each time I press Ctrl+Shift+T
it will change to other reference style, if I am in x1A1 it will change to
x1R1C1 and vice versa

Thanks



Simon S[_2_]

Help with Macro
 
Rick, Great help, thanks

"Rick Rothstein" wrote:

This single statement will toggle between the two settings...

Application.ReferenceStyle = (xlR1C1 + xlA1) - Application.ReferenceStyle

--
Rick (MVP - Excel)


"Simon S" wrote in message
...
Hi,

I am new to macros and I need some help

I regularly have to change the reference style from x1A1 to x1R1C1 and
back
again. So I made the following macro using Ctrl+Shift+T as the keyboard
short cut

Application.ReferenceStyle = xlR1C1
End Sub

Is there a way I can get it to toggle, i.e. each time I press Ctrl+Shift+T
it will change to other reference style, if I am in x1A1 it will change to
x1R1C1 and vice versa

Thanks




Harald Staff[_2_]

Help with Macro
 
That's a clever one :-)

"Rick Rothstein" wrote in message
...
This single statement will toggle between the two settings...

Application.ReferenceStyle = (xlR1C1 + xlA1) - Application.ReferenceStyle

--
Rick (MVP - Excel)




All times are GMT +1. The time now is 02:31 AM.

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