+ Reply to Thread
Results 1 to 3 of 3

VBA: IF Formula returning object defined error

  1. #1
    Registered User
    Join Date
    05-29-2019
    Location
    Dundee
    MS-Off Ver
    2016
    Posts
    20

    VBA: IF Formula returning object defined error

    Morning all,

    I have the below code to try and run through a list of start and end dates of an array to return the date after the start date.

    Please Login or Register  to view this content.
    ws has already been defined as the worksheet earlier in the code and the IF formula if I write it direct onto the worksheet is correct but when I try and add the IF formula into my VBA code it is returning an object defined error.

    Any idea where I have gone wrong?

    Many Thanks in advance
    WombleJim

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA: IF Formula returning object defined error

    I always use the macro recorder to record my formulas. I then modify them as needed.

    ws.Range("E2:E" & NextRow + 1).FormulaR1C1 = "=IF((RC[-2]-1)>RC[-3],RC[-3]+1,"""")"
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    05-29-2019
    Location
    Dundee
    MS-Off Ver
    2016
    Posts
    20

    Re: VBA: IF Formula returning object defined error

    Thank you mehmetcik, That works like a charm.

    Thanks again
    Womblejim

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula, VBA, Run-time error 1004 - Application-defined or object-defined error
    By dude6571 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-05-2019, 07:54 AM
  2. [SOLVED] getting application defined or object defined error through vba formula
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2018, 01:32 AM
  3. VBA ERROR: run time error 1004: Application-defined or Object-defined error in excel 2013
    By AnanthKrishna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2015, 06:16 AM
  4. Replies: 1
    Last Post: 03-12-2014, 12:42 PM
  5. Replies: 1
    Last Post: 05-06-2013, 06:07 AM
  6. Application-defined or object-defined error with vba .formula
    By RogerKMiller in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-26-2013, 03:37 PM
  7. Application-defined or Object-defined error on Formula entry
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2009, 01:33 PM

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