Minggu, 01 Januari 2012

[ExcelVBA] Macro to change reference style

 

Hi group!
First Happy new Year to all!

Long time you did not read from me.
I try a long time (and Google a lot) before I turn to you, but this time I do not find much.

I am trying to quickly change the Excel formula style.

Here is one of the many codes that I have tried.
This one is the longest: I am pretty sure there are lots of unnecessary code in it.

Public xReference As XlReferenceStyle
Sub Switch_Reference_Style()
'shortcut CTRL w

If xReference = xlA1 Then
xReference = xlR1C1
Application.ReferenceStyle = xlR1C1

Exit Sub
End If

If xReference = xlR1C1 Then
xReference = xlA1
Application.ReferenceStyle = xlA1
Exit Sub
End If
End Sub

Each of those lines, tried separately, work.
Application.ReferenceStyle = xlR1C1

or

Application.ReferenceStyle = xlA1

But the quick switch does not.

Thanks for you help

Louise

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar