![]() |
aligning textboxes on worksheet by cell reference?
how can i code in vba xy positions of textboxes on a worksheet according to a cell reference? e.g. textbox1 is aligned with cell a1, textbox2 is aligned with cell c1, etc. thanks. -- dreamz ------------------------------------------------------------------------ dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462 View this thread: http://www.excelforum.com/showthread...hreadid=481957 |
aligning textboxes on worksheet by cell reference?
Public Sub FitObjectToRange(MyObject As Object, MyLocation As Range)
MyObject.Top = MyLocation.Top MyObject.Left = MyLocation.Left MyObject.Width = MyLocation.Width MyObject.Height = MyLocation.Height End Sub Example of use: FitObjectToRange ActiveSheet.TextBox1, Range("A1") FitObjectToRange ActiveSheet.TextBox2, Range("C1") MyObject can be any object that has a .top, .left, .width, and .height (e.g. commandbuttons, images, ...) MyLocation can be a cell or a range of cells -- - K Dales "dreamz" wrote: how can i code in vba xy positions of textboxes on a worksheet according to a cell reference? e.g. textbox1 is aligned with cell a1, textbox2 is aligned with cell c1, etc. thanks. -- dreamz ------------------------------------------------------------------------ dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462 View this thread: http://www.excelforum.com/showthread...hreadid=481957 |
All times are GMT +1. The time now is 12:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com