+ Reply to Thread
Results 1 to 14 of 14

compile error method or data member not found will not run as a sub

  1. #1
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Arrow compile error method or data member not found will not run as a sub

    I am back needing help again. I have written an error check sub routine to check for blank required cells before the row status is completed. I am getting a compile error, “Method or Data Member not Found” and I don’t understand the Microsoft help file. Could someone help me and explain what I am missing please? The Sign_In sheet is where the data is entered and column “K” is the final status for the row. It will display the fill of the cell green and the ending code will be shown in the cell. For the ending code “ATR” in column “K”, cells in columns “I”, “J”, “L” can’t be blank or empty in that row. The cells missing the data will fill red and the “K” column will turn yellow to indicate a problem in that row. The code worked fine until I changed it to a sub routine. All help is greatly appreciated!

    I have uploaded a sample workbook.

    Here is my code:
    Please Login or Register  to view this content.
    Thanks again for any help received.
    Attached Files Attached Files

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: compile error method or data member not found will not run as a sub

    You have to define the SheetName you're working on.

    Either you use
    Please Login or Register  to view this content.
    or the Sheet CodeName
    Please Login or Register  to view this content.
    Also you don't define where Srn stands for. If you want to loop through your records you need to do something like this
    Please Login or Register  to view this content.
    Code would look like this.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 05-24-2018 at 08:12 PM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: compile error method or data member not found will not run as a sub

    Thanks for your help.
    I thought that the
    Please Login or Register  to view this content.
    was defining the SheetName?

    So what did that define?

    The Srn was the target row from the WorkSheet ("Sign_In") I forgot that I could not carry that over into the Subroutine.
    This is to be run only when the target Row column "K" is closed by the entry of "ATR" (This does the error check for the required data entry.

    I do have others that will run with other codes but I should be able to do those once I can get this running.

    Am I to do something with
    Please Login or Register  to view this content.
    or is this just an information line?
    I am still new at this and trying to learn as I go, but sometimes I just can't seem to understand what is happening to write my code. Please bear with me as a NOOB. I won't be able to try it on the actual WorkSheet until tomorrow when I get back to work!
    Thanks Again for the help.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: compile error method or data member not found will not run as a sub

    It did indeed define the sheetname but after that you don't use it in your further code like this.
    Please Login or Register  to view this content.
    But why did you convert it to a Sub if you want to run it automatically. That can only be done with Event-code.
    Now you will have to assign this code to a button or Shortcut-key in order to use it.

  5. #5
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: compile error method or data member not found will not run as a sub

    I was told to use subs for redundant code to speed up programing. I can send to the error check sub using this (in yellow) on the Sign_In sheet.
    Please Login or Register  to view this content.
    After the error check and corrections are done then the green code is to be run to close the status of that row.
    I have other status code groups that will have common error checks so I figured that I can get this one working then adapt the others from this one.
    I used your code but couldn't get it to work. This is what I am trying to get the code to do for the ATR code: 1. check column cell "I" if it is empty then change the fill color to red, clear contents of "K", send error message for cell "I", turn cell "K" to yellow, exit sub if error is found to make the corrections, 2. the same for column cell "J" and "L", If no errors are found Turn "K" green with "ATR" in the cell then to return and execute the array in green.
    I tried to have the code exit on error (Exit Sub) but it only runs once then stops. I have attached another updated Workbook showing what I am trying to do.
    Here is the updated code:
    Please Login or Register  to view this content.
    Thanks for your help.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: compile error method or data member not found will not run as a sub

    Sorry about picking the wrong colors for highlight. Here is what was in yellow:
    Please Login or Register  to view this content.
    And this is what was in green:
    Please Login or Register  to view this content.
    Thanks for the help.

  7. #7
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: compile error method or data member not found will not run as a sub

    I just noticed in the code you did for me you are starting the rows at row 4 and the workbook actually starts at row #5. I will change it and try the code again.

  8. #8
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: compile error method or data member not found will not run as a sub

    I still can't get it to run, it just stops with no error.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: compile error method or data member not found will not run as a sub

    This one sets the colors and Text in columns I, J, K & L.

    If incomplete data is discovered a Msgbox gives warning.

    Let's start from this and work our way further on.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 05-26-2018 at 01:32 AM.

  10. #10
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: compile error method or data member not found will not run as a sub

    It now gives me a compile error Srn not defined. I put this code into the sub routine module. and called it from sheet1("Sign_In"). Could you please explain what is happening in the code?

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: compile error method or data member not found will not run as a sub

    All variables weren't declared yet.
    Try example file now.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: compile error method or data member not found will not run as a sub

    bakerman2 thanks for all your help. I think I have found another way to do this.

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: compile error method or data member not found will not run as a sub

    You're welcome and good luck with your project.

    Thanks for rep+.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  14. #14
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: compile error method or data member not found will not run as a sub

    Sorry I forgot to do that. It's done now. Thanks again.

+ 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] Compile Error: Method or data member not found
    By jtsev13 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-24-2018, 04:07 AM
  2. Compile error Method or data member not found
    By kwesmc1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-30-2016, 02:47 PM
  3. Compile error:Method or data member not found
    By vshukla in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2015, 11:44 AM
  4. Compile Error Method or data member not found
    By ixelister in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2014, 03:39 PM
  5. Compile Error: Method of data member not found (VBA)
    By vbatech in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 03-14-2012, 05:37 PM
  6. Compile Error:Method or Data Member Not Found
    By loknath in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-29-2012, 04:03 AM
  7. Compile Error Method or data member not found
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2005, 06:05 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