View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_406_] Leith Ross[_406_] is offline
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