Link to home
Start Free TrialLog in
Avatar of glennmgray
glennmgray

asked on

Excel VBA button keeps moving when clicked

I recorded a macro in excel to run a query.  Even though I checked "Save the password with the data" every time I select "Data:Refresh Data" it prompts for the password.  I want other people to be able to refresh the data without knowing the password so I put the password in the macro and loaded the code into the click event of a button I placed on the worksheet.  I set the data to start in A5 and put the button in B2.  Every time I click the button it correctly refreshes the data, but then moves the button to I2 which is off the screen making it look like the button has disappeared.  Is there any way to get it to stay put?
Avatar of dirknibleck
dirknibleck

Are you inserting columns in your code? If columns are inserted after your code moves the button, this could be the problem.
ASKER CERTIFIED SOLUTION
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of glennmgray

ASKER

That worked, Thanks