RAKESH230583
New Member
- Joined
- Jan 10, 2011
- Messages
- 46
Dear All,
Userform1 :
Combobox1 - Which shows different country list. "Country A, Country B, Country C, Country D, Country E, Country F, Country G, Country H & Country I"
Combobox2 - Which is required to show the Start Time + 1 Hour, based on selection from combobox1.
Now, For each countries there is a pre-defined start time. Which is maintained in Excel sheet Named as "Source".
Column A2:A10 shows country Names and Column E2:E10 shows the default start time.
So, for example If I had select "Country A" from combobox1 then combobox2 must default show me time as 06:30 PM (Default Start Time 05:30:00 PM + 1 Hour). Which can be further modified by the user from combobox2 only.
I am using the below line of cods in combobox1 Click event.
If Me.Combobox1.Value = "Country A" Or If Me.Combobox1.Value = "Country B" Then
Userform1.Combbox2.value = "06:30:00 PM"
ElseIf Me.Combobox1.Value ="Country C" Or Me.Combobox1.Value = "Country D" Or Me.Combobox1.value = "Country E" Then
Usefom1.Combobox2.value ="07:30:00 PM"
(Elseif Continued :"08:30:00 PM" for Country F, G & H & "10:30:00 PM" For Country I.)
Also - Using below codes in Userform_Initialize event for Combobox2 to show the Time list.
Dim H As long
Dim M As Long
For H = 12 To 23
For M = 0 To 59
Me.Combobx2.Additem Format(TimeSerial(H,M,0), "hh:mm:ss AM/PM")
Next M
Next H
Question:
1) Though by using above codes I am getting the results i.e. Start Time + 1 Hour (But - I don't want combobox to show the times which is before the Start Time as per Country selection in Combobox1.
Userform1 :
Combobox1 - Which shows different country list. "Country A, Country B, Country C, Country D, Country E, Country F, Country G, Country H & Country I"
Combobox2 - Which is required to show the Start Time + 1 Hour, based on selection from combobox1.
Now, For each countries there is a pre-defined start time. Which is maintained in Excel sheet Named as "Source".
Column A2:A10 shows country Names and Column E2:E10 shows the default start time.
So, for example If I had select "Country A" from combobox1 then combobox2 must default show me time as 06:30 PM (Default Start Time 05:30:00 PM + 1 Hour). Which can be further modified by the user from combobox2 only.
I am using the below line of cods in combobox1 Click event.
If Me.Combobox1.Value = "Country A" Or If Me.Combobox1.Value = "Country B" Then
Userform1.Combbox2.value = "06:30:00 PM"
ElseIf Me.Combobox1.Value ="Country C" Or Me.Combobox1.Value = "Country D" Or Me.Combobox1.value = "Country E" Then
Usefom1.Combobox2.value ="07:30:00 PM"
(Elseif Continued :"08:30:00 PM" for Country F, G & H & "10:30:00 PM" For Country I.)
Also - Using below codes in Userform_Initialize event for Combobox2 to show the Time list.
Dim H As long
Dim M As Long
For H = 12 To 23
For M = 0 To 59
Me.Combobx2.Additem Format(TimeSerial(H,M,0), "hh:mm:ss AM/PM")
Next M
Next H
Question:
1) Though by using above codes I am getting the results i.e. Start Time + 1 Hour (But - I don't want combobox to show the times which is before the Start Time as per Country selection in Combobox1.