Linked Questions
116 questions linked to/from How do I put double quotes in a string in vba?
386
votes
13
answers
687k
views
How to create a string or formula containing double quotes in Excel?
How can I construct the following string in an Excel formula:
Maurice "The Rocket" Richard
If I'm using single quotes, it's trivial: ="Maurice 'The Rocket' Richard" but what ...
20
votes
3
answers
109k
views
Excel (2007) VBA - .Formula with quotes in it [duplicate]
I tried putting the following code into a program yesterday. VBA called an error. I assume it is because of the double quotes inside the formula. I googled and all results I found just gave the ...
10
votes
5
answers
147k
views
How to add a Formula To Cell using VBA [duplicate]
I am attempting to write some VBA which will add header text to 3 cells then fill a formula all the way down to the last row. I have written the below, which writes the headers no problems, but when ...
4
votes
1
answer
35k
views
Expected End of Statement in formula with quotes [duplicate]
Sub FillNames()
Range("D2:D56").SpecialCells(xlCellTypeBlanks).Formula = _
"=IF(AND(C>800,C<900), "YES", "NO")"
End Sub
I get the compile error expected: end of statement. It seems to ...
0
votes
2
answers
5k
views
How to paste a formula via Macro in cell? [duplicate]
I am trying to paste a formula in Excel cell via VBA but with no luck.
When i try this code it perfectly works -
ActiveSheet.Range("B7").Value = "=VLOOKUP(A7,$A$1:$B$3,2,0)"
But when i try this code
...
1
vote
3
answers
2k
views
Quotation Marks VBA [duplicate]
I'm creating a function that inputs a formula into a cell. But I keep on receiving a syntax error. I know this is due to the quotation marks. I was wondering how I would go about including the ...
-1
votes
2
answers
2k
views
AverageIF in VBA with dynamic range [duplicate]
I have a VBA Code that creates a pivot table and then finds the average based on the dynamic range (as the size of the pivot table is always changing)
I would like to use AVERAGEIF function instead ...
1
vote
1
answer
2k
views
Excel Macro - Error Inserting Formula that contains double quotes into ActiveCell [duplicate]
I have a situation here. There is a excel sheet in which lets say cell A1 as following formula.
=(IF(ISERROR(VALUE(SUBSTITUTE(OFFSET(B10,-1,0,1,1),".",""))),1,IF(ISERROR(FIND("`",SUBSTITUTE(OFFSET(...
-1
votes
1
answer
711
views
Using " as a character in a statement [duplicate]
Hi there I am trying to use " as a character in my code, but VBA always auto corrects it as excess characters (like if I try """). I tried to use the Char(34) character code but it still doesn't work. ...
2
votes
2
answers
1k
views
How to save a formula as a string in VBA [duplicate]
I've got the following code
Sub reset_formulas()
uptime_formula = "=IFS(AND(C25="Deployed",C26="Returned"), B26-B25, AND(C25="Returned",C26="Deployed"), 0,...
0
votes
1
answer
2k
views
How do I enter a net use string into CMD using the VBA Shell command? [duplicate]
I'm simply trying to find the right syntax to pass the following command to cmd.
net use P: "\\s0501svm1\home\John Smith"
If I type the below then it doesn't work, presumably because the double ...
0
votes
2
answers
358
views
Syntax error in vba excel code [duplicate]
I am adding a button in my excel sheet for adding an employee with above used formulas.
First two formulas in the below code work perfect but last one giving syntax error.
My code is :
Private ...
0
votes
2
answers
880
views
VBA Formula R1C1 Code [duplicate]
I am trying to put the formula in a range using the code below, but it is throwing error. Can someone help?
shtRpt. Range("rng"). FormulaR1C1 = " =OFFSET(INDIRECT(" Sheet1! A1"), Match(RC[30],...
0
votes
0
answers
638
views
Use Single Quote As Part Of Replace Statement In VBA [duplicate]
I am needing to replace a single quote with nothing, using VBA. I put together this syntax, but it is reading my single quote as a comment indicator. I also tried to put two single quotes but that ...
1
vote
2
answers
402
views
Range.Formula is giving a Run-time error because of variables [duplicate]
Goodmorning everyone,
I'm a beginner with VBA trying out various things.
Atm I'm trying to get a formula to be placed inside a row of cells but I'm encountering a problem.
I use a number of variables ...