Vba help

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello All

Is there a way of changing the way the VBA code is displayed.

If I record a macro like A4=a1+A2+A3

The code shows ActiveCell.FormulaR1C1 = "=+R[-1]C+R[-2]C+R[-3]C"
which can be difficult to read
Can you change this to state the actual cell reference.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
In XL2007
It's
-Excel Options / Formulas
--Working with formulas
---Uncheck the "R1C1 Style reference" option
 
Upvote 0
Hello All

Is there a way of changing the way the VBA code is displayed.

If I record a macro like A4=a1+A2+A3

The code shows ActiveCell.FormulaR1C1 = "=+R[-1]C+R[-2]C+R[-3]C"
which can be difficult to read
Can you change this to state the actual cell reference.

VBA natively uses R1C1, and this is not an option that you can toggle for the recorder, sadly. I would suggest manually editing the code so that it reads how you prefer:

ActiveCell.Formula = "=A1+A2+A3"
 
Upvote 0
You can get VB to help you straighten that formula out. In code returned by the Recorder is this...
Code:
ActiveCell.FormulaR1C1 = "=+R[-1]C+R[-2]C+R[-3]C"
First, select an empty cell on any worksheet. Next, Copy/paste that entire code line into the Immediate Window and hit the Return key to execute it. Next, execute this line of code in the Immediate Window...
Code:
? ActiveCell.Formula
Now, go back int the code window and delete the characters "R1C1" from the code line and replace all that R/C stuff with the last printout from the Immediate Window.
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,153
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top