+ Reply to Thread
Results 1 to 4 of 4

adding to an existing line of VBA code

Hybrid View

  1. #1
    Registered User
    Join Date
    02-01-2006
    Posts
    60

    adding to an existing line of VBA code

    Hi All,

    Hoping that someone can help me modify the formula below.

    ActiveCell.FormulaR1C1 = _
    "=IF(ISNUMBER(R[1]C[1]),R[1]C[1],IF(ISNUMBER(R[2]C[1]),R[2]C[1],IF(ISNUMBER(R[3]C[1]),R[3]C[1],IF(ISNUMBER(R[4]C[1]),R[4]C[1]))))"

    At the moment the formula checks the cells to see if they contains a number. If it does it puts the result in the active cell.

    Now what I need to do is change the formula so if it is not a number it checks to see if the contents of the cell start with "FN". If it does find a cell which starts with "FN" it should put the results in the active cell. How can I add that check into the formula above?

    something like IF(LEFT(R[1),2)="FN",R[1]C[1]??

    Thanks all.

    Garry

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Gary

    I hope I understand what you are after

    try

    ActiveCell.FormulaR1C1 = _
    "=IF(OR(ISNUMBER(R[1]C[1]),LEFT(R[1]C[1],2)=""FN""),R[1]C[1],IF(OR(ISNUMBER(R[2]C[1]),LEFT(R[2]C[1],2)=""FN""),R[2]C[1],IF(OR(ISNUMBER(R[3]C[1]),LEFT(R[3]C[1],2)=""fn""),R[3]C[1],IF(OR(ISNUMBER(R[4]C[1]),LEFT(R[4]C[1],2)=""fn""),R[4]C[1]))))"

  3. #3
    Registered User
    Join Date
    02-01-2006
    Posts
    60

    Thumbs up

    Thanks Mudraker it worked a treat.

    Top Stuff
    Garry

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Glad to hear I supplied what you were after

+ 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