Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reference Tab name to two textboxes AOU Excel Discussion (Misc queries) 5 December 8th 06 09:57 AM
Aligning decimal numers to the centre of the cell and aligning dec Ramesh Babu Excel Discussion (Misc queries) 1 July 1st 06 10:33 PM
Aligning Reference numbers ringnab Excel Discussion (Misc queries) 0 June 28th 06 10:57 PM
Copying multiline textboxes from userform to worksheet cell Leighton Harker Excel Programming 1 September 25th 04 04:14 PM
how do I link Textboxes in a userform to a Cell in a Worksheet? Paul Clark Excel Programming 2 January 17th 04 05:16 PM


All times are GMT +1. The time now is 07:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"