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

x
  • 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?
0
glennmgray
Asked:
glennmgray
1 Solution
 
dirknibleckCommented:
Are you inserting columns in your code? If columns are inserted after your code moves the button, this could be the problem.
0
 
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".

Kevin
0
 
glennmgrayAuthor Commented:
That worked, Thanks
0

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