Excel button errors


  1. Posts : 20
    W7
       #1

    Excel button errors


    I have several macros in my Excel 2003 that work fine when run manually (either F5 or F8), but when run from a forms button, do something different, such as jump to the wrong cell. I usually don't have a problem with using a button.
      My Computer


  2. Posts : 9,746
    Windows 7 Home Premium 64 bit sp1
       #2

    You need to check that macro formula is correct for the button application & matches the key formula exactly.
      My Computer


  3. Posts : 6,021
    Win 7 HP SP1 64-bit Vista HB SP2 32-bit Linux Mint 18.3
       #3

    Does the Macro have Active Cell (where the cursor needs to be in order for the Macro to run correctly) at the top of the Macro or is the cell hard coded?
      My Computer


  4. Posts : 20
    W7
    Thread Starter
       #4

    Thanks for the quick reply. Not sure what you mean by "You need to check that macro formula is correct for the button application & matches the key formula exactly.". I wrote a macro and assigned it to a button and it worked ok, but now doesn't. Note that it works manually just fine. Also note that the cursor has to be in the correct cell for it to start, but I'm sure it is, as that is the most convenient way for this macro to be used. As for the ActiveCell comment, here is the first line:
    ActiveCell.Offset(-1, 1).Range("A1").Select Why did it work before and not now? I must have changed something.
      My Computer


  5. Posts : 6,021
    Win 7 HP SP1 64-bit Vista HB SP2 32-bit Linux Mint 18.3
       #5

    Hi ah100,

    Basically, what that line of code does is, wherever the cursor is in the SpreadSheet it goes 1 cell up and 1 cell to the right.
    Why don't you just hard code the actual cell you want to start the Macro in.
    I assume that your Macro has been recorded?

    I hope this helps!
      My Computer


  6. Posts : 20
    W7
    Thread Starter
       #6

    I use the offset command because I don't start in a particular cell, but offset (-1,1) locates the right cell. I have done some adding and removing of whole rows and wonder if maybe there is some confusion in the macro on what to do. Will investigate. Funny that it works manually, but not with the button.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 21:58.
Find Us