0

I was wondering how to get a excel formula I have to work in VBA?

Sheet1.Range("AF9").Formula = "=IF(AND(AA9<>"",AB9<>"",AC9<>"",AD9="",AE9=""),""""&AA9&""","&""""&AB9&""","&""""&AC9&""","&""""","&"""""","")"

That is my current vba code (not working) ...

This is what the formula is in the excel sheet itself...

=IF(AND(AA9<>"",AB9<>"",AC9<>"",AD9="",AE9=""),""""&AA9&""","&""""&AB9&""","&""""&AC9&""","&""""","&"""""","")

I am not finding the linked answer helpful. I understand the double quotes part but I'm not understanding why the commas are causing an error.

Scott Craner
  • 148,073
  • 10
  • 49
  • 81
xVernx
  • 3
  • 2
  • that article suggested is not the same question as i am having issues with the commas and quotes – xVernx May 04 '22 at 13:42
  • 1
    I keep removing the unnecessary parts of your question. We do not use platitudes and fluff in the question, or answers for that matter. The `,` are not the problem. Every `"` in the working excel formula needs to be doubled `""` to work. That is what the answer to the duplicate is saying. – Scott Craner May 04 '22 at 13:43
  • 1
    Here: `Sheet1.Range("AF9").Formula = "=IF(AND(AA9<>"""",AB9<>"""",AC9<>"""",AD9="""",AE9=""""),""""""""&AA9&"""""",""&""""""""&AB9&"""""",""&""""""""&AC9&"""""",""&"""""""""",""&"""""""""""","""")"` – Scott Craner May 04 '22 at 13:47
  • 1
    That worked great! sorry i am very new to these types of websites and apologize for using the forum incorrectly Thank you! – xVernx May 04 '22 at 14:00

0 Answers0