+ Reply to Thread
Results 1 to 3 of 3

VBA Insert If And Formula

Hybrid View

  1. #1
    Registered User
    Join Date
    07-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    33

    VBA Insert If And Formula

    Hello,

    I am trying to insert an IF AND formula to a specific cell. I have the following code, but it does not seem to work for me.

       
        
        Range("E9").Select
    
        If Range("C9").Value = "WBOCM Custom Module" And Range("C10").Value = """" Then
            Range("E9").Value = "D9&"" ""&D10,D9"
        Else
            Range("E9").Value = ""
        End If
    Here is the if function I am trying to add:
    =IF(AND(C9="WBOCM Custom Module",C10=""),D9&" "&D10,D9)
    Any help is much appreciated!

    Many thanks in advance!
    los

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    If you want to put the IF formula in a cell you can try this.

    Range("E9").Formula = "=IF(AND(C9=""WBOCM Custom Module"",C10=""""),D9&"" ""&D10,D9)"
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: VBA Insert If And Formula

    Thanks Norie. It worked!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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