+ Reply to Thread
Results 1 to 8 of 8

error 1004 application defined error (Moving click button)

  1. #1
    Registered User
    Join Date
    07-13-2011
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    21

    error 1004 application defined error (Moving click button)

    Hi there

    I was wondering if any you could help.

    I have this code that has been working fine. To run the code I was using a click button which up until now has been located on the same sheet (called “Hourly_ Calculations”). Now I would like to move the button to another sheet (Called “Data_Input”) so it is easier for the user. This seems to be causing problems. I know I need to be telling VBA what sheet to use otherwise it will assume the activesheet I think this is were the problem lies but I think I am doing this already, however I am probably incorrect

    Anyhow the debugger highlights this line of code

    Please Login or Register  to view this content.
    This line of code is included in an if statement as below

    Please Login or Register  to view this content.
    I’m new to this but I don’t understand why its not working as the sheet the range is on is referred to in the code,

    Where am I going wrong

    Thank you
    Last edited by mdavid800; 08-08-2011 at 10:13 AM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: error 1004 application defined error (Moving click button)

    Assuming that you do have variables called off2 and off3 then I'd guess that the cells function isn't referring to the sheet you think it is.

    If you replace the line giving an error with:

    Please Login or Register  to view this content.

    Does that sort out the issue?

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: error 1004 application defined error (Moving click button)

    Hi mdavid800, perhaps it would be best if you posted your full procedure for us to look at and try to find a solution.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: error 1004 application defined error (Moving click button)

    Or Andrew-R has solved it for you !

  5. #5
    Registered User
    Join Date
    07-13-2011
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    21

    Re: error 1004 application defined error (Moving click button)

    that did not seem to change anything Andrew. as suggested here is the full procedure encase it helps.

    Please Login or Register  to view this content.
    Last edited by mdavid800; 08-08-2011 at 09:59 AM.

  6. #6
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: error 1004 application defined error (Moving click button)

    Is it still breaking on the same line if you make my change? Did you cut and paste from my example or retype it? If the latter did you make sure you used .Cells rather than Cells?

  7. #7
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: error 1004 application defined error (Moving click button)

    Hi mdavid800, this is not tested but copy and past the following procedure back into you module.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-13-2011
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    21

    Re: error 1004 application defined error (Moving click button)

    Hi there guys. Sorry Andrew you were correct i typed it in and missed the .cells when i copied/pasted it seemed to do the trick.

    Thanks both of you for the help.

    David

+ 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