+ Reply to Thread
Results 1 to 2 of 2

Inputting text in a formula

  1. #1
    Registered User
    Join Date
    06-13-2005
    Posts
    21

    Inputting text in a formula

    I'm trying to write an if statement using VBA that returns text, however I can't seem to figure out how to get it to work as I need to include apostrophes in the if statement. Below is the code that I'm working with:

    Range("V2").Formula = "=IF(" & "Q2" & ">0," & "Indemnity" & "," & "Medical" & ")"

    Any help would be greatly appreciated.

    Thanks,
    Peter

  2. #2
    Bernie Deitrick
    Guest

    Re: Inputting text in a formula

    Peter,

    Range("V2").Formula = "=IF(Q2>0,""Indemnity"",""Medical"")"

    HTH,
    Bernie
    MS Excel MVP


    "PGalla06" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I'm trying to write an if statement using VBA that returns text, however
    > I can't seem to figure out how to get it to work as I need to include
    > apostrophes in the if statement. Below is the code that I'm working
    > with:
    >
    > Range("V2").Formula = "=IF(" & "Q2" & ">0," & "Indemnity" & "," &
    > "Medical" & ")"
    >
    > Any help would be greatly appreciated.
    >
    > Thanks,
    > Peter
    >
    >
    > --
    > PGalla06
    > ------------------------------------------------------------------------
    > PGalla06's Profile: http://www.excelforum.com/member.php...o&userid=24260
    > View this thread: http://www.excelforum.com/showthread...hreadid=398605
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1