Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mat Mat is offline
external usenet poster
 
Posts: 4
Default Move a drop down via VBA?

I need to create a drop down in vba. I can do this, but
later it needs to be moved, but it MUST keep it's original
value. Is there a way I can do this? Is there a function
specifically for moving objects? Or am I going to have to,
somehow, get the selected value of the drop down, then
delete it, and re create it at i's new co-ordinates?
Thanks for your help.
Mat
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Move a drop down via VBA?


If it is a shape, a shape has top, left, width and height properties.

Sub AAA()
With ActiveSheet.Shapes("Drop Down 1")
.Top = Range("B9").Top
.Left = Range("B9").Left
End With

End Sub


as an example placed the dropdown on top of Cell B9. This is a dropdown
from the forms toolbar. If you are talking about data=validation using the
List type, you will need to store the value and re-create it.

--
Regards,
Tom Ogilvy


Mat wrote in message
...
I need to create a drop down in vba. I can do this, but
later it needs to be moved, but it MUST keep it's original
value. Is there a way I can do this? Is there a function
specifically for moving objects? Or am I going to have to,
somehow, get the selected value of the drop down, then
delete it, and re create it at i's new co-ordinates?
Thanks for your help.
Mat



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Move a drop down via VBA?

and if its an ActiveX control, the same is true...


Sub Moveit(Target As Range)

With Sheet1.ComboBox1
.Top = Target.Top
.Left = Target.Left
.Width = Target.Width
.Height = Target.Height
End With

End Sub

If you set the sheet's SelectionChange method to call this procedure,
passing the target cell, then the combo box will "follow" the selected cell
around the sheet....very annoying ;)

--
Patrick Molloy
Microsoft Excel MVP
----------------------------------
"Tom Ogilvy" wrote in message
...

If it is a shape, a shape has top, left, width and height properties.

Sub AAA()
With ActiveSheet.Shapes("Drop Down 1")
.Top = Range("B9").Top
.Left = Range("B9").Left
End With

End Sub


as an example placed the dropdown on top of Cell B9. This is a dropdown
from the forms toolbar. If you are talking about data=validation using

the
List type, you will need to store the value and re-create it.

--
Regards,
Tom Ogilvy


Mat wrote in message
...
I need to create a drop down in vba. I can do this, but
later it needs to be moved, but it MUST keep it's original
value. Is there a way I can do this? Is there a function
specifically for moving objects? Or am I going to have to,
somehow, get the selected value of the drop down, then
delete it, and re create it at i's new co-ordinates?
Thanks for your help.
Mat





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
Borders that move when i drag and drop contents Chuck Excel Discussion (Misc queries) 0 September 17th 09 03:41 PM
How can I move or resize drop down box? CaRT6128 Excel Discussion (Misc queries) 2 August 25th 09 07:49 PM
USE DRAG AND DROP TO MOVE FILES tyco Excel Discussion (Misc queries) 1 October 28th 07 10:08 AM
Move entire row to another worksheet based on drop list selection Coyote Excel Worksheet Functions 0 February 2nd 07 05:52 PM
Move data from one sheet to another using drop down lists. pwtechmn Excel Worksheet Functions 3 October 16th 05 12:36 AM


All times are GMT +1. The time now is 11:22 PM.

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

About Us

"It's about Microsoft Excel"