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 create a button to reset ComboBoxs

I have Created a Sheet for people to enter specs, and it automatically
Creates, P/N's and Descriptions. Well The people I have created this
for, are not so Bright at times. So there for I want to create a Button
that Reset's all Combo-Box list's back to the top selection.
Basically you have
Colors
Black
Blue
Green.

They select blue, Then when they are finished, they just hit a button
to Select color again.


See I have about 15 Combo Boxs Created, so its hard for them to go back
and select the Original Settings. Well I know that they can just close
the File and open the Original, but They sometimes Save over the top of
that one, so I have to constantly send them the Original.
So this is why I'd like to create a reset Combo-Boxes Button.

I have tried recording macro's, and it does not work with, Control Tool
Box, or Forms.

Anyone have any Suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How do I create a button to reset ComboBoxs

How about one of these:

Option Explicit
Sub testme04()
Dim myDropDown As DropDown
For Each myDropDown In Worksheets("sheet1").DropDowns
myDropDown.Value = 1
Next myDropDown
End Sub

Sub testme05()
Dim OLEObj As OLEObject
For Each OLEObj In Worksheets("sheet1").OLEObjects
If TypeOf OLEObj.Object Is MSForms.ComboBox Then
OLEObj.Object.ListIndex = 0
End If
Next OLEObj
End Sub

Top one is for Forms and the bottom one for controltoolbox toolbar.

noirnor wrote:

I have Created a Sheet for people to enter specs, and it automatically
Creates, P/N's and Descriptions. Well The people I have created this
for, are not so Bright at times. So there for I want to create a Button
that Reset's all Combo-Box list's back to the top selection.
Basically you have
Colors
Black
Blue
Green.

They select blue, Then when they are finished, they just hit a button
to Select color again.

See I have about 15 Combo Boxs Created, so its hard for them to go back
and select the Original Settings. Well I know that they can just close
the File and open the Original, but They sometimes Save over the top of
that one, so I have to constantly send them the Original.
So this is why I'd like to create a reset Combo-Boxes Button.

I have tried recording macro's, and it does not work with, Control Tool
Box, or Forms.

Anyone have any Suggestions?


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I create a button to reset ComboBoxs

Thank you so Much, it works Wonderful.

This is what I have below now, Works Just Perfectly.



Sub Reset()

Dim OLEObj As OLEObject
For Each OLEObj In Worksheets("Spec Sht").OLEObjects
Worksheets("Data Sht").OLEObjects
If TypeOf OLEObj.Object Is MSForms.ComboBox Then
OLEObj.Object.ListIndex = 0
End If
Next OLEObj


ActiveWindow.SmallScroll Down:=15
Range("B26").Select
Selection.ClearContents
Range("A27:C30").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-27
Range("B3:B6").Select
Selection.ClearContents
Range("C3").Select
Range("C17:C20").Select
Selection.ClearContents
Range("C3").Select
Selection.ClearContents
Range("B4").Activate

End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I create a button to reset ComboBoxs

After I posted it, I knew you were going to say that, so I figured that
one out. Thanks. You have been alot of help. I might be asking for
more In lil while. ;)

Thanks Again,
noirnor
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I create a button to reset ComboBoxs

Just to show you what I have now.

Sub Reset()

Dim OLEObj As OLEObject
For Each OLEObj In Worksheets("Spec").OLEObjects
Worksheets("Data").OLEObjects
If TypeOf OLEObj.Object Is MSForms.ComboBox Then
OLEObj.Object.ListIndex = 0
End If

Next OLEObj
For Each OLEObj In Worksheets("Spec").OLEObjects
If TypeOf OLEObj.Object Is MSForms.TextBox Then
OLEObj.Object.Text = Clear
End If
Next OLEObj

Range("B26:C26,B3:B6,C3,C17:C20").Select
Selection.ClearContents
Range("B4").Select
Range("B4").Activate
End Sub


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How do I create a button to reset ComboBoxs

You don't have to select that range to clearcontents.

Range("B26:C26,B3:B6,C3,C17:C20").ClearContents
Range("B4").Select
Range("B4").Activate

And I'm not sure what the .activate does that .select didn't. (I'd either drop
the last line or the last two lines--why change the selection from what the user
already had???)




noirnor wrote:

Just to show you what I have now.

Sub Reset()

Dim OLEObj As OLEObject
For Each OLEObj In Worksheets("Spec").OLEObjects
Worksheets("Data").OLEObjects
If TypeOf OLEObj.Object Is MSForms.ComboBox Then
OLEObj.Object.ListIndex = 0
End If

Next OLEObj
For Each OLEObj In Worksheets("Spec").OLEObjects
If TypeOf OLEObj.Object Is MSForms.TextBox Then
OLEObj.Object.Text = Clear
End If
Next OLEObj

Range("B26:C26,B3:B6,C3,C17:C20").Select
Selection.ClearContents
Range("B4").Select
Range("B4").Activate
End Sub


--

Dave Peterson

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
RESET BUTTON CandiC Excel Worksheet Functions 2 November 2nd 09 10:19 PM
How do I create a "Reset Data" Button for a Worksheet? Billy Excel Worksheet Functions 3 December 15th 08 09:29 PM
Reset Button Raz Excel Worksheet Functions 3 November 26th 08 11:32 PM
Reset Button Raz Excel Worksheet Functions 4 November 26th 08 05:26 PM
Reset Button trilogy Excel Discussion (Misc queries) 0 July 27th 06 03:36 AM


All times are GMT +1. The time now is 01:09 AM.

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"