ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need to you quotations ("") in a string. (https://www.excelbanter.com/excel-programming/417563-need-you-quotations-string.html)

RyanH

Need to you quotations ("") in a string.
 
I have a formula that requires quotations around the X in the formula but VBA
will not allow me to do it. Is there a way around this because I have to
have the quotations around the X in the formula bar for the formula to work.

Sub InsertFormula()

Const Depts As String = "Engineering"

With Sheets("Summary")
.Range("D34").Formula = "=SUMPRODUCT(--(" & Depts &
"Dates<=$J$4),--(" & Depts & "Indicators="X")," & Depts & "Hours)*(1+$J$10)"

End With
End Sub
--
Cheers,
Ryan

Jim Thomlinson

Need to you quotations ("") in a string.
 
Double up the quotes...

With Sheets("Summary")
.Range("D34").Formula = "=SUMPRODUCT(--(" & Depts &
"Dates<=$J$4),--(" & Depts & "Indicators=""X"")," & Depts & "Hours)*(1+$J$10)"

End With

--
HTH...

Jim Thomlinson


"RyanH" wrote:

I have a formula that requires quotations around the X in the formula but VBA
will not allow me to do it. Is there a way around this because I have to
have the quotations around the X in the formula bar for the formula to work.

Sub InsertFormula()

Const Depts As String = "Engineering"

With Sheets("Summary")
.Range("D34").Formula = "=SUMPRODUCT(--(" & Depts &
"Dates<=$J$4),--(" & Depts & "Indicators="X")," & Depts & "Hours)*(1+$J$10)"

End With
End Sub
--
Cheers,
Ryan



All times are GMT +1. The time now is 06:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com