confused as to what [&]

Gregfox

Board Regular
Joined
Apr 12, 2011
Messages
120
1.I am confused as to what [&] means does itdenote what is between the [&] is a string like:

& this is a string & ?

2 If I want to put a formula in a certain cell like J2 to be (B2 – NamedCell) would I;
Code:
[COLOR=#000000][FONT=Calibri]DIM ABC as string [/FONT][/COLOR]
[COLOR=#000000][FONT=Calibri]ABC = NamedCell    ; set ABC as a named cell
[/FONT][/COLOR]
[COLOR=#000000][FONT=Calibri] Range(J2).Formula =  “=(“B3” -  “& ABC &”)”    ‘? I’m confused about the quotes and the prentices[/FONT][/COLOR]
Thank you
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Code:
Range("J2").Formula = "=B2 - ABC"
You don't need any parentheses.
 
Upvote 0
Code:
DIM ABC as string
ABC = NC   'where NC is a named cell
Range("J2").Formula = "=B2 - ABC"
The above didn't work and resulter in #NAME error in J2 [$150 - #NAME ]
any thoughts?
 
Upvote 0
i'm not really sure how named ranges work in VBA but i assume it's referring to something through code
Code:
Range("J2").Formula = "=B2 - ABC"
having ABC in quotations will make it into a string so in cell J2 you probably have the formula =B2 - ABC
maybe change it to
Code:
Range("J2").Formula = "=B2 -" & ABC

i'm not great on technical details and stuff but i always just thought of & as something that combines things into a string, and using quotations turns things into text. so like if you go to a cell and put in =A1 it will return whatever value is in cell A1, but if you put ="A1" the cell will just have the text A1 in it
 
Upvote 0
Maybe this


Code:
Dim abc As Range
Set abc = Range("NC")  'where NC is a named cell
Range("J2").Formula = "=B2 -" & abc & ""
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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