![]() |
Placing button at cell's location
I'm creating buttons in VBA, trying to place them at a given cell's
location, using the Top and Left properties of the cell. It works well enough near the top of a worksheet, but as I go further and further down the rows, the button is getting placed further and further below the top of the cell. For example, at row 121, the cell's Top property was about 1530, but if I place a button at the top of row 121, that button has a Top property of about 1500, which is between the tops of rows 123 and 124. I've been doing this with the old Forms buttons to enable creating them with parameters, so that all of the buttons call into the same function, but each with a different parameter (that part is working fine). But I tried it with ActiveX buttons too and got the same problem with the button's Top property not being the same as the row or cell's Top property. What do I need to do to place these buttons at the top of a given row? FWIW, I haven't tested whether the same problem exists with the Left property. These buttons are all going into column B, so this isn't really an issue with the horizontal placement. Thanks, Greg |
Placing button at cell's location
On Jan 15, 10:14 am, Greg Lovern wrote:
What do I need to do to place these buttons at the top of a given row? I've just discovered that I can get consistent placement by copying or cutting the button, then selecting a cell at the desired row, and pasting. That seems to work well enough, but is there a more direct way to get consistent placement? Thanks, Greg |
Placing button at cell's location
On Jan 15, 10:14 am, Greg Lovern wrote:
For example, at row 121, the cell's Top property was about 1530, but if I place a button at the top of row 121, that button has a Top property of about 1500, which is between the tops of rows 123 and 124. Sorry, I meant to say: For example, at row 121, the cell's Top property was about 1530, but if I place a button there, that button's top is between the tops of rows 123 and 124. If I manually place a button at the top of row 121, that button has a Top property of about 1500. Greg |
Placing button at cell's location
Is your zoom factor set to 100%?
If no, try changing to 100%, then add the buttons. Greg Lovern wrote: I'm creating buttons in VBA, trying to place them at a given cell's location, using the Top and Left properties of the cell. It works well enough near the top of a worksheet, but as I go further and further down the rows, the button is getting placed further and further below the top of the cell. For example, at row 121, the cell's Top property was about 1530, but if I place a button at the top of row 121, that button has a Top property of about 1500, which is between the tops of rows 123 and 124. I've been doing this with the old Forms buttons to enable creating them with parameters, so that all of the buttons call into the same function, but each with a different parameter (that part is working fine). But I tried it with ActiveX buttons too and got the same problem with the button's Top property not being the same as the row or cell's Top property. What do I need to do to place these buttons at the top of a given row? FWIW, I haven't tested whether the same problem exists with the Left property. These buttons are all going into column B, so this isn't really an issue with the horizontal placement. Thanks, Greg -- Dave Peterson |
Placing button at cell's location
On Jan 15, 11:46 am, Dave Peterson wrote:
Is your zoom factor set to 100%? If no, try changing to 100%, then add the buttons. Thanks, that fixes it. I had also just found that if I just move it right after creating it (that is, move it to the very same location at which had I tried to create it), like this: MyButton.Top = MyRange.Top That seems to work fine, without changing the zoom. Zoom was at 90%. Greg |
All times are GMT +1. The time now is 09:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com