+ Reply to Thread
Results 1 to 2 of 2

how to insert IF function into cell?

Hybrid View

  1. #1
    Registered User
    Join Date
    11-10-2010
    Location
    Slovakia
    MS-Off Ver
    Excel 2003
    Posts
    1

    how to insert IF function into cell?

    Hi I need to insert in cell some IF Function, like this:
    =IF(AND($F$3>K5;$F$3<K6);M5;0)
    how I can do it?
    This is not working:

             
    Cells(5, i * 6 + 2) = "=IF(AND($F$3>K5;$F$3<K6);M5;0)"
    Last edited by DonkeyOte; 11-10-2010 at 11:12 AM. Reason: added CODE tags

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: how to insert IF function into cell?

    VBA is generally US-centric - as a result you would use US based delimiters, eg:

    Cells(5,i * 6 + 2) = "=IF(AND($F$3>K5,$F$3<K6),M5,0)"
    Obviously this can be confusing if you're unfamiliar with the requisite syntax so MS also make available the FormulaLocal property

    Cells(5,i * 6 + 2).FormulaLocal = "=IF(AND($F$3>K5;$F$3<K6);M5;0)"
    this way you can use your own native syntax

    On an aside please always encase Code within CODE tags - even one liners.

+ 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