none
how can i add two or more temp combo boxes in one sheet in excel RRS feed

  • Question

  • Hi,

    I want to use drop down data validation with combo box. In on column it is list of text as drop down. In another column it is time value as drop down, like 00:00,00:10,00:20,00:30.................23:50. The later case works fine with data validation drop down. When temp combo box works the time value in cell changes to values like 1.3333333 or 1.456387 etc.

    I want to add two more temp combo boxes with separate codes, can it be done ?

    please help

    Tuesday, June 9, 2015 4:20 PM

Answers

All replies

  • Try the following ComboBox Change Event code to convert the format of the selection. Assumes times are hours and minutes. Change format string if minutes and seconds.

    Private Sub ComboBox1_Change()
        ComboBox1.Value = Format(ComboBox1.Value, "hh:mm")
    End Sub


    Regards, OssieMac

    Wednesday, June 10, 2015 7:26 AM
  • Hi OssieMac,

    I feel , I did not ask properly. There is dropdown data validation in four columns up to rows 10 to 35. Two of columns have text values in data validation dropdown. Other two columns have time value in data validation dropdown. I have vba code for temporary combo box to appear when data validation is used instead it. This temporary combo box work fine with text value. When I use drop down in columns where time values are used the value get changed. So I want different temporary combo boxes for different columns. Or other way to get it work.

    Thanks

    Wednesday, June 10, 2015 1:48 PM
  • My understanding of the problem is that the combo box drop downs display the times correctly but when you select a time it is displayed in the combobox as a decimal number.

    Like in the picture the display in the top combo is a decimal number but the display in the bottom combo is time format. The code is applied to the bottom combo box when the selection is made so that it displays correctly.

    The code is for ActiveX combobox; not forms control combobox.


    Regards, OssieMac

    Thursday, June 11, 2015 3:55 AM
  • Hi OssieMac,

    Yes the same problem. Another point is that there is no permanent combo box on the worksheet. It appears only when data validation drop down is used. When I use your code , it des not work.

    I formed source range as text , it works fine.

    Further calculation is not working now .

    Thursday, June 11, 2015 2:59 PM
  • From your reply I am assuming that you are creating new combo boxes with code. If that is the case then instead of creating new comboxes with code, create the combo boxes and then set the visible property to false and then unhide them when they are required. That way you can create the required code to go with them.

    Regards, OssieMac

    Thursday, June 11, 2015 8:46 PM
  • Please see this file

    http://1drv.ms/1JKhaug

    Thank you.

    Friday, June 12, 2015 1:31 PM
  • See the file at the following link. I added the code between the asterisk lines at the top of the first sheet module and commented out Private Sub TempCombo_MouseMove.

    http://1drv.ms/1ThDP44


    Regards, OssieMac

    Friday, June 12, 2015 10:18 PM
  • Thank you OssieMac
    Saturday, June 13, 2015 1:01 AM