Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I get a reference to a control on a sheet?

I am using VBA in Excel XP and Win 2k

I have several drop down controls on a sheet. The control are NOT ActiveX objects.

How do I loop through all the controls on the sheet and set them all to list index 0 (the first choice)

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default How do I get a reference to a control on a sheet?

I am using VBA in Excel XP and Win 2k.

I have several drop down controls on a sheet. The control are NOT ActiveX objects.

How do I loop through all the controls on the sheet and set them all to list index 0 (the first choice)?


try this:

Sub ResetDropDown()
Dim shpDropDown As Shape

For Each shpDropDown In ActiveSheet.Shapes
If shpDropDown.FormControlType = xlDropDown Then
shpDropDown.ControlFormat.ListIndex = 1
End If
Next shpDropDown
End Sub


--
Regards

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)

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
Nesting a sheet name reference within a cell reference??? Broyston Excel Discussion (Misc queries) 9 July 8th 08 08:35 PM
Changing sheet reference to cell reference TeeJay Excel Worksheet Functions 3 October 19th 07 11:50 AM
Control in Chart Sheet Anderflash Charts and Charting in Excel 6 June 7th 07 10:26 PM
Control Sheet Cedrun Excel Worksheet Functions 2 October 4th 06 09:48 PM
Syntax to return the value of a control by reference Broadband Al Excel Discussion (Misc queries) 3 January 26th 06 01:20 AM


All times are GMT +1. The time now is 04:12 AM.

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"