![]() |
Adding a Button
How can I add a button {from form controls} to the active sheet if I
want it to be in a specific position? Ideally, I want the button to be aligned in one row and contained between three columns - my problem is that I won't know before hand which row I want to restrict by. The sheet I'm dealing with will have a variable amount of data every time it is generated by my code, and I always want the button to be at the end of the data. Any ideas? -bgetson |
Adding a Button
something along these lines:
Sub AD() With Cells(Cells(Rows.Count, 1).End(xlUp).Row, 10) Set btn = ActiveSheet.Buttons.Add( _ Left:=.Left, _ Top:=.Top, _ Width:=.Resize(1, 3).Width, _ Height:=.Height) End With btn.OnAction = "MyMacro" End Sub -- Regards, Tom Ogilvy " wrote: How can I add a button {from form controls} to the active sheet if I want it to be in a specific position? Ideally, I want the button to be aligned in one row and contained between three columns - my problem is that I won't know before hand which row I want to restrict by. The sheet I'm dealing with will have a variable amount of data every time it is generated by my code, and I always want the button to be at the end of the data. Any ideas? -bgetson |
Adding a Button
Thank you so much for your help. To be honest, when I'd asked for
help, I'd basically resigned myself to reformatting everything so that my buttons were on top and everything else displayed underneath. The code you provided works perfectly, and I can easily get it to work for my project. Thanks again. |
All times are GMT +1. The time now is 05:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com