Need to you quotations ("") in a string.

  • Thread starter Thread starter RyanH
  • Start date Start date
R

RyanH

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top