+ Reply to Thread
Results 1 to 8 of 8

Run-time error '1004' - Method 'Range' of object '_Worksheet' failed

  1. #1
    Registered User
    Join Date
    12-23-2018
    Location
    Swindon, England
    MS-Off Ver
    2016
    Posts
    4

    Run-time error '1004' - Method 'Range' of object '_Worksheet' failed

    Hi,
    I'm new here on the forum and new to VBA, this is my first attempt to create a Userform. I have the problem stated within the title of this post and I would really appreciate any help. Below is the code:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Veronik; 12-25-2018 at 09:55 AM.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Run-time error '1004' - Method 'Range' of object '_Worksheet' failed

    I deleted then retyped this line of code and the error went away.
    Please Login or Register  to view this content.
    Sometimes the gremlins get in there and retyping is the way to get them out.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    12-23-2018
    Location
    Swindon, England
    MS-Off Ver
    2016
    Posts
    4

    Re: Run-time error '1004' - Method 'Range' of object '_Worksheet' failed

    Quote Originally Posted by JLGWhiz View Post
    I deleted then retyped this line of code and the error went away.
    Please Login or Register  to view this content.
    Sometimes the gremlins get in there and retyping is the way to get them out.
    Thank you for your reply, I like the "gremlins" thing, I could use it as an excuse at work Nevertheless, my gremlins are stubborn and don't want to go away, still not working

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Run-time error '1004' - Method 'Range' of object '_Worksheet' failed

    I don't see any ranges named SHIFTList, AUDITORList, etc. I see ranges named SHIFT, AUDITOR, ...
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Run-time error '1004' - Method 'Range' of object '_Worksheet' failed

    Quote Originally Posted by shg View Post
    I don't see any ranges named SHIFTList, AUDITORList, etc. I see ranges named SHIFT, AUDITOR, ...
    Hah! Didn't even check the name manager. That will sure cause some grief.

  6. #6
    Registered User
    Join Date
    12-23-2018
    Location
    Swindon, England
    MS-Off Ver
    2016
    Posts
    4

    Re: Run-time error '1004' - Method 'Range' of object '_Worksheet' failed

    "I don't see any ranges named SHIFTList, AUDITORList, etc. I see ranges named SHIFT, AUDITOR, ... "

    Hi and thank you for your suggestion. As I said I'm new to this, as self-learner and not very sure of what I'm doing. I this what I should do?
    Dim cSHIFTList As Range
    Dim cAUDITORList As Range
    Dim cMODELList As Range
    Dim cSTEPList As Range

    Because I did it and now I have the following issue:

    Compile error: variable not defined

    For Each cSHIFT In ws.Range("SHIFTList")
    Last edited by Veronik; 12-24-2018 at 04:06 AM.

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

    Re: Run-time error '1004' - Method 'Range' of object '_Worksheet' failed

    Please add Code Tags to your opening post as per Forum Rule #2.


    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    You have set the RowSource for every Combobox-object so you don't have access through your Initialize-Code.
    Attached Files Attached Files
    Last edited by bakerman2; 12-24-2018 at 05:59 AM.
    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.

  8. #8
    Registered User
    Join Date
    12-23-2018
    Location
    Swindon, England
    MS-Off Ver
    2016
    Posts
    4

    Re: Run-time error '1004' - Method 'Range' of object '_Worksheet' failed

    Quote Originally Posted by bakerman2 View Post

    You have set the RowSource for every Combobox-object so you don't have access through your Initialize-Code.
    Thank you very much for your help and I want to thank everyone for their support and the learning opportunity I had.
    I also want to wish everyone (where applicable, of course) happy Christmas!
    And last but not least I have some more questions/issues (that's what happens when you're looking for answers and find out that are some other things you could do to make things even more efficient) and I don't know how I should proceed - do I have to open new thread(s)? Please advise.

    My questions/issues are:
    1. I would like to make the Userform from my DCLP-PV-FORM workbook to open the DCLP-PV-REP workbook, feed data onto it, save and close it. The reason behind this is that the form has to be filled in by certain people and after that other people will process the information from the collecting data base and it is more than desirable for the first category of people not to be able to access the target data base.
    2. Is it possible to set the form in such a way that will unable the user to close/submit the form unless EVERY field is completed? We have a major problem with incomplete information being submitted.
    3. Is it possible to set the form in such a way that the user can't fill in in the Combo Boxes other information than the information established within the LookupLists? The aim is to standardise the data entry content in order to ease the final reporting process from the collecting data base.
    4. Looking for information how to achieve the above I couldn't get to a working result but I found out that is possible to create interactive Userforms which I tried and now I'm completely lost.

    Again, I would appreciate any help if anyone is willing to clean up the mess I did and you have my thanks in advance.
    If not, until I'll learn some more and be able to do it myself, I'm declaring myself happy anyway with the help I received already and I'll mark the thread as solved since my initial request for help has been answered and solved.
    Attached Files Attached Files
    Last edited by Veronik; 12-25-2018 at 10:52 PM.

+ 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] Run-time error '1004': Method 'Range' of object '_worksheet' failed
    By Ms2BSwagg in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 03-31-2021, 12:25 PM
  2. run-time error '1004' method 'range' of object '_worksheet' failed
    By Emma_B in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-26-2014, 09:00 AM
  3. [SOLVED] Help! Error 1004, method 'Range' of object'_Worksheet' failed.
    By zac_595 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-07-2013, 02:55 PM
  4. [SOLVED] How can I resolve this Run-Time error '1004': Method 'Range' of object '_Worksheet' failed
    By dafella in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2013, 01:16 AM
  5. Run time Error 1004 Method 'Range' object '_Worksheet 'failed
    By Monica1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2013, 07:42 AM
  6. me too - run-time error '1004' method 'range' of object '_worksheet' failed
    By ASAFSWIS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2013, 05:14 PM
  7. [SOLVED] Name a dynamic range - Run-time error 1004 Method 'Range' of object'_Worksheet' failed
    By DavidBW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-03-2012, 08:00 AM

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