Using quotes in a formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • if1467
    New Member
    • Feb 2008
    • 25

    Using quotes in a formula

    I am trying to have the following formula entered into a cell, but the "No" in the If statement is causing VB problems.

    Any work arounds?

    Code:
    TotTx = "=If(Netting = 'No',If(" & MyCells(rownum2, 11) & ">0," & MyCells(rownum2, 11) & "+" & MyCells(rownum2, 12) & "," & MyCells(rownum2, 12) & ")," & MyCells(rownum2, 11) & "+" & MyCells(rownum2, 12) & ")"
    ActiveSheet.Cells(rownum2, 13) = TotTx
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by if1467
    I am trying to have the following formula entered into a cell, but the "No" in the If statement is causing VB problems.

    Any work arounds?

    Code:
    TotTx = "=If(Netting = 'No',If(" & MyCells(rownum2, 11) & ">0," & MyCells(rownum2, 11) & "+" & MyCells(rownum2, 12) & "," & MyCells(rownum2, 12) & ")," & MyCells(rownum2, 11) & "+" & MyCells(rownum2, 12) & ")"
    ActiveSheet.Cells(rownum2, 13) = TotTx
    may be using Chr(34) will help

    [CODE=vb]TotTx = "=If(Nettin g =" & chr(34) & "No" & chr(34) & ",If(" & MyCells(rownum2 , 11) & ">0," & MyCells(rownum2 , 11) & "+" & MyCells(rownum2 , 12) & "," & MyCells(rownum2 , 12) & ")," & MyCells(rownum2 , 11) & "+" & MyCells(rownum2 , 12) & ")"[/CODE]

    Comment

    • if1467
      New Member
      • Feb 2008
      • 25

      #3
      Originally posted by kadghar
      may be using Chr(34) will help

      [CODE=vb]TotTx = "=If(Nettin g =" & chr(34) & "No" & chr(34) & ",If(" & MyCells(rownum2 , 11) & ">0," & MyCells(rownum2 , 11) & "+" & MyCells(rownum2 , 12) & "," & MyCells(rownum2 , 12) & ")," & MyCells(rownum2 , 11) & "+" & MyCells(rownum2 , 12) & ")"[/CODE]
      That worked. Thank. Another tool in my box!!

      Comment

      Working...