Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default How to copy Dropdown boxes?

I have several Dropdown boxes created from Toolbars-Forms. And I am trying
to copy them into another sheet of the same workbook. The strange thing is
when I do it manually, it is totally fine. No problem at all.

When I try to record a macro, This is what I get
------------------------------------------------------------------------------------------------
Range("A10:B26").Select
Selection.Copy
Sheets("Destination").Select
Range("A11").Select
ActiveSheet.DropDowns.Add(5.25, 222, 87, 21.75).Select
ActiveSheet.DropDowns.Add(5.25, 298.5, 87, 21.75).Select
ActiveSheet.DropDowns.Add(3, 369, 89.25, 23.25).Select
ActiveSheet.Paste
------------------------------------------------------------------------------------------------
The problem is when I was trying to run the macro I just recorded, the macro
didn't do the exact samething as I did manually when I was recording the
macro. It will put some Dropbox in the same place. But my format control is
all gone. And the macro will put another picture of the 3 dropdown box
somewhere on the spreadsheet. And the text around the dropdown boxes only
appears on the picture I get.

I was trying to investigate what's going on. The problem is I can't find the
object 'DropDowns' through the object explorer, and I can't find any 'Add'
Method like what is recorded in the macro. Could anybody help me out? Thanks
a lot!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to copy Dropdown boxes?


Hello Salut,

The Forms controls are belong to the *Shapes* class of the Worksheet
Here is a macro that will copy all the Drop Downs from one Worksheet t
another.


Code
-------------------

Sub CopyDropDowns(ByVal From_Worksheet As String, ByVal To_Worksheet As String)

Set SrcWks = ActiveWorkbook.Worksheets(From_Worksheet)
Set DstWks = ActiveWorkbook.Worksheets(To_Worksheet)

For Each S In SrcWks.Shapes
If S.Type = msoFormControl Then
If S.FormControlType = xlDropDown Then
DstWks.Shapes.AddFormControl xlDropDown, S.Left, S.Top, S.Width, S.Height
End If
End If
Next S

End Sub

-------------------


Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=49556

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
Dropdown boxes (box 1 result = box 2 Greg Excel Worksheet Functions 4 August 14th 09 03:19 PM
dependent dropdown boxes Kevin M Excel Worksheet Functions 0 December 8th 05 10:51 PM
UDF, Change Event and Dropdown boxes Martin[_21_] Excel Programming 7 June 6th 05 06:26 PM
Forms - Dropdown Boxes Olivia Excel Programming 0 November 18th 04 09:43 PM
AutoFilter Dropdown Boxes Missing Dave Peterson[_3_] Excel Programming 0 July 9th 03 04:29 AM


All times are GMT +1. The time now is 10:14 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"