Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Hi,
    This one should be easy for me but I'm having a brain cramp... if someone could help me out it would be greatly appreciated. I want the macro to put the following formula into cell AL2 in Excel, but my "" are giving me an error message. I know I've done this before, but I can't remember how I got it to work, nor can I find where I used it before. My actual test macro is below the formula.

    =IF(O2<>"CASHPAY","N/A",IF(SUMIF($N$2:$N$65536,N2,$M$2:$M$65536)=0,"Cle ared","O/S"))


    Sub formula()

    'Add formula to column AL for CASHPAY check status

    Sheet5.Select
    Range("AL2") = "=IF(O2<>"CASHPAY","N/A",IF(SUMIF($N$2:$N$65536,N2,$M$2:$M$65536)=0,"Cle ared","O/S"))"


    End Sub

    Thanks!
    Lana

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You have to double each quote within the formula, because the formula itself is enclosed in quotes. Otherwise, VBA will think the formula ends at the first quote within the string.

    Range("AL2").Formula = "=IF(O2<>""CASHPAY"",""N/A"",IF(SUMIF($N$2:$N$65536,N2,$M$2:$M$65536)=0,""C leared"",""O/S""))"

  3. #3
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Ahh.. yes, I tried everything except that! Thanks Hans!
    Lana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •