@symbol showing in formula when using VBA

BradleyS

Active Member
Joined
Oct 28, 2006
Messages
333
Office Version
  1. 2010
Platform
  1. Windows
When I manually enter this formula (using DNRs):
IF(REASONTBL<>"<No Selection>",REASONTBL=K2,1) into a cell it works fine.

However, when I use VBA
Range("L2").Formula = "=IF(REASONTBL<>""<No Selection>"",REASONTBL=K2,1)"

it shows in the cell as: IF(@REASONTBL<>"<No Selection>",@REASONTBL=K2,1) and doesn't work due to the @ symbols that have appeared.

Why is it doing this and how can I resolve it?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You need to use Formula2, rather than Formula.

I would also suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Solution
Thank you that worked great. I have also updated my account details.
 
Upvote 0
I am personally, but when I use it at the office, they only have 2010, so I always need to make sure it works in 2010.
 
Upvote 0
Ok, fair enough, but using Formlua2 will probably return an error when using 2010 as it didn't exist then.
 
Upvote 0
Ah. OK so the @ symbol will not appear in 2010, which means I can still use "formula" and it will still work. Even though it's showing an error in my 365 version.
I can work with that. Thank you
 
Upvote 0

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

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