[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

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?
1 Solution
Are you inserting columns in your code? If columns are inserted after your code moves the button, this could be the problem.
zorvek (Kevin Jones)ConsultantCommented:
Right-click on the command button and select Format Control. Navigate to the Properties tab and select "Don't move or size with cells".

glennmgrayAuthor Commented:
That worked, Thanks

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now