+ Reply to Thread
Results 1 to 3 of 3

Error Msg: "Compile error: Method or data member not found" in VBA code

  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Error Msg: "Compile error: Method or data member not found" in VBA code

    I have this code below, but there's an error that keeps coming up that I don't know how to fix.

    Please Login or Register  to view this content.

    The error says:
    "Compile error: Method or data member not found"

    Then when I click OK, it highlights in yellow ".targCellX" in the following part of the code:

    Please Login or Register  to view this content.
    Please help!
    Thannks!
    Last edited by nenadmail; 08-28-2012 at 11:54 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Error Msg: "Compile error: Method or data member not found" in VBA code

    if you have had some msgbox(s) or used immediate window you would have found out

    these are entries in immedite window
    ?targetsh.Name
    Movement History----this is ok
    ?targetx.Address
    $F$1:$AX$1---this is ok


    now next code is
    Set targCellX = targetX.Find(0, , xlFormulas, xlWhole)
    that means you are trying to search for the value 0 in F1:AX1
    suppose there is no 0 in F1:AX1-F1:AX1 looks like column heading may not contain 0
    then there is no targcellx and macro could not find the cell
    after above code
    Set targCellX = targetX.Find(0, , xlFormulas, xlWhole)

    you should have a code
    if no tartcellx is nothing then(this means if the macro does find some cell containing 0 in F1:AX1
    targcolx=targcellx.column
    else(that means macro did not find such acell

    <then what to do you want to.write thse code(s)>
    end if

    that end if is necesswary


    when you send such macros it would be helpful to help you if the at least small extract of data sheet(s) are also
    posted m(you can always attach a small file in this newsgroup) if files are sent the macros are also embedded in the file

    that yellow line means error.

    now rewrite the macro
    I am not an expert. better solutions may be available
    [email protected]

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Error Msg: "Compile error: Method or data member not found" in VBA code

    Also check and remove any references in Visual Basic Editor (VBE) that start with MISSING
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

+ 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