+ Reply to Thread
Results 1 to 4 of 4

Application-defined or object-defined error

Hybrid View

  1. #1
    Registered User
    Join Date
    02-27-2014
    Location
    Hungary
    MS-Off Ver
    Excel 2007
    Posts
    14

    Application-defined or object-defined error

    Hello,

    I would like to do the following calculation with and "if" function but I recieve the above error message..

    I would appreciate if somone could help.


    Sub calc()

    If Cells("D7").Value = "USD/JPY" Then

    Cells("I7") = Cells("C13") * Cells("H7")

    End If

    Best Regards,

    Endre

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Application-defined or object-defined error

    Change Cells to Range
    If Range("D7").Value = "USD/JPY" Then
    
        Range("I7") = Range("C13") * Range("H7")
    
    End If
    PS Can you add code tags?
    If posting code please use code tags, see here.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Application-defined or object-defined error

    Hi

    Cells() syntax take row and column number parameters.

    Try instead

    If Range("D7").Value = "USD/JPY" Then
    
    Range("I7") = Range("C13") * Range("H7")
    
    End If
    or
    If Cells(7,4).Value = "USD/JPY" Then
    
    Cells(7,9) = Cells(13,3) * Cells(7,8)
    
    End If
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    02-27-2014
    Location
    Hungary
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Application-defined or object-defined error

    Thank you for the quick help.

    I will use code tags in the future.

+ 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] application-defined/object-defined error 1004 when trying to read from or write to cells
    By florin_excel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-30-2012, 08:38 AM
  2. Replies: 2
    Last Post: 09-12-2012, 01:01 PM
  3. Application Defined or Object Defined Error, Command Button and Vlookup Function
    By stevedomer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-14-2011, 11:20 PM
  4. Replies: 3
    Last Post: 07-24-2006, 08:20 PM
  5. RE: Runtime error 1004- application defined or object defined erro
    By Novice in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2006, 05:40 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